diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs index 9f3d6490186..def05f22a0d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs @@ -40,6 +40,7 @@ internal static class ApiUrlLookup internal static ApiUrls ClusterPendingTasks = new ApiUrls(new[] { "_cluster/pending_tasks" }); internal static ApiUrls ClusterPostVotingConfigExclusions = new ApiUrls(new[] { "_cluster/voting_config_exclusions" }); internal static ApiUrls ClusterPutComponentTemplate = new ApiUrls(new[] { "_component_template/{name}" }); + internal static ApiUrls ClusterPutSettings = new ApiUrls(new[] { "_cluster/settings" }); internal static ApiUrls ClusterStats = new ApiUrls(new[] { "_cluster/stats", "_cluster/stats/nodes/{node_id}" }); internal static ApiUrls CrossClusterReplicationDeleteAutoFollowPattern = new ApiUrls(new[] { "_ccr/auto_follow/{name}" }); internal static ApiUrls CrossClusterReplicationFollow = new ApiUrls(new[] { "{index}/_ccr/follow" }); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsRequest.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsRequest.Converters.g.cs new file mode 100644 index 00000000000..04aec684cd3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsRequest.Converters.g.cs @@ -0,0 +1,72 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Cluster.Json; + +public sealed partial class PutClusterSettingsRequestConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropPersistent = System.Text.Json.JsonEncodedText.Encode("persistent"); + private static readonly System.Text.Json.JsonEncodedText PropTransient = System.Text.Json.JsonEncodedText.Encode("transient"); + + public override Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue?> propPersistent = default; + LocalJsonValue?> propTransient = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propPersistent.TryReadProperty(ref reader, options, PropPersistent, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, static object (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!))) + { + continue; + } + + if (propTransient.TryReadProperty(ref reader, options, PropTransient, static System.Collections.Generic.IDictionary? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, static object (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!))) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.SafeSkip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Persistent = propPersistent.Value, + Transient = propTransient.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropPersistent, value.Persistent, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, object v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))); + writer.WriteProperty(options, PropTransient, value.Transient, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IDictionary? v) => w.WriteDictionaryValue(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, object v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsRequest.g.cs new file mode 100644 index 00000000000..a1d32be08e8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsRequest.g.cs @@ -0,0 +1,354 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Cluster; + +public sealed partial class PutClusterSettingsRequestParameters : Elastic.Transport.RequestParameters +{ + /// + /// + /// Return settings in flat format (default: false) + /// + /// + public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } + + /// + /// + /// Explicit operation timeout for connection to master node + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// Explicit operation timeout + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } +} + +/// +/// +/// Update the cluster settings. +/// +/// +/// Configure and update dynamic settings on a running cluster. +/// You can also configure dynamic settings locally on an unstarted or shut down node in elasticsearch.yml. +/// +/// +/// Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. +/// You can also reset transient or persistent settings by assigning them a null value. +/// +/// +/// If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) elasticsearch.yml setting; 4) Default setting value. +/// For example, you can apply a transient setting to override a persistent setting or elasticsearch.yml setting. +/// However, a change to an elasticsearch.yml setting will not override a defined transient or persistent setting. +/// +/// +/// TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. +/// If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. +/// Only use elasticsearch.yml for static cluster settings and node settings. +/// The API doesn’t require a restart and ensures a setting’s value is the same on all nodes. +/// +/// +/// WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. +/// If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration. +/// +/// +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.Json.PutClusterSettingsRequestConverter))] +public sealed partial class PutClusterSettingsRequest : Elastic.Clients.Elasticsearch.Requests.PlainRequest +{ +#if NET7_0_OR_GREATER + public PutClusterSettingsRequest() + { + } +#endif +#if !NET7_0_OR_GREATER + public PutClusterSettingsRequest() + { + } +#endif + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + internal override Elastic.Clients.Elasticsearch.Requests.ApiUrls ApiUrls => Elastic.Clients.Elasticsearch.Requests.ApiUrlLookup.ClusterPutSettings; + + protected override Elastic.Transport.HttpMethod StaticHttpMethod => Elastic.Transport.HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "cluster.put_settings"; + + /// + /// + /// Return settings in flat format (default: false) + /// + /// + public bool? FlatSettings { get => Q("flat_settings"); set => Q("flat_settings", value); } + + /// + /// + /// Explicit operation timeout for connection to master node + /// + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// + /// Explicit operation timeout + /// + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// + /// The settings that persist after the cluster restarts. + /// + /// + public System.Collections.Generic.IDictionary? Persistent { get; set; } + + /// + /// + /// The settings that do not persist after the cluster restarts. + /// + /// + public System.Collections.Generic.IDictionary? Transient { get; set; } +} + +/// +/// +/// Update the cluster settings. +/// +/// +/// Configure and update dynamic settings on a running cluster. +/// You can also configure dynamic settings locally on an unstarted or shut down node in elasticsearch.yml. +/// +/// +/// Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. +/// You can also reset transient or persistent settings by assigning them a null value. +/// +/// +/// If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) elasticsearch.yml setting; 4) Default setting value. +/// For example, you can apply a transient setting to override a persistent setting or elasticsearch.yml setting. +/// However, a change to an elasticsearch.yml setting will not override a defined transient or persistent setting. +/// +/// +/// TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. +/// If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. +/// Only use elasticsearch.yml for static cluster settings and node settings. +/// The API doesn’t require a restart and ensures a setting’s value is the same on all nodes. +/// +/// +/// WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. +/// If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration. +/// +/// +public readonly partial struct PutClusterSettingsRequestDescriptor +{ + internal Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest Instance { get; init; } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutClusterSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest instance) + { + Instance = instance; + } + + public PutClusterSettingsRequestDescriptor() + { + Instance = new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + public static explicit operator Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor(Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest instance) => new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor(instance); + public static implicit operator Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest(Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor descriptor) => descriptor.Instance; + + /// + /// + /// Return settings in flat format (default: false) + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor FlatSettings(bool? value = true) + { + Instance.FlatSettings = value; + return this; + } + + /// + /// + /// Explicit operation timeout for connection to master node + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.MasterTimeout = value; + return this; + } + + /// + /// + /// Explicit operation timeout + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? value) + { + Instance.Timeout = value; + return this; + } + + /// + /// + /// The settings that persist after the cluster restarts. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Persistent(System.Collections.Generic.IDictionary? value) + { + Instance.Persistent = value; + return this; + } + + /// + /// + /// The settings that persist after the cluster restarts. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Persistent() + { + Instance.Persistent = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// The settings that persist after the cluster restarts. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Persistent(System.Action? action) + { + Instance.Persistent = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor AddPersistent(string key, object value) + { + Instance.Persistent ??= new System.Collections.Generic.Dictionary(); + Instance.Persistent.Add(key, value); + return this; + } + + /// + /// + /// The settings that do not persist after the cluster restarts. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Transient(System.Collections.Generic.IDictionary? value) + { + Instance.Transient = value; + return this; + } + + /// + /// + /// The settings that do not persist after the cluster restarts. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Transient() + { + Instance.Transient = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(null); + return this; + } + + /// + /// + /// The settings that do not persist after the cluster restarts. + /// + /// + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Transient(System.Action? action) + { + Instance.Transient = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringObject.Build(action); + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor AddTransient(string key, object value) + { + Instance.Transient ??= new System.Collections.Generic.Dictionary(); + Instance.Transient.Add(key, value); + return this; + } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + internal static Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest Build(System.Action? action) + { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor(new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); + action.Invoke(builder); + return builder.Instance; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor ErrorTrace(bool? value) + { + Instance.ErrorTrace = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor FilterPath(params string[]? value) + { + Instance.FilterPath = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Human(bool? value) + { + Instance.Human = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor Pretty(bool? value) + { + Instance.Pretty = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor SourceQueryString(string? value) + { + Instance.SourceQueryString = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor RequestConfiguration(Elastic.Transport.IRequestConfiguration? value) + { + Instance.RequestConfiguration = value; + return this; + } + + public Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor RequestConfiguration(System.Func? configurationSelector) + { + Instance.RequestConfiguration = configurationSelector.Invoke(Instance.RequestConfiguration is null ? new Elastic.Transport.RequestConfigurationDescriptor() : new Elastic.Transport.RequestConfigurationDescriptor(Instance.RequestConfiguration)) ?? Instance.RequestConfiguration; + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsResponse.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsResponse.Converters.g.cs new file mode 100644 index 00000000000..eca9b04f813 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsResponse.Converters.g.cs @@ -0,0 +1,81 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Cluster.Json; + +public sealed partial class PutClusterSettingsResponseConverter : System.Text.Json.Serialization.JsonConverter +{ + private static readonly System.Text.Json.JsonEncodedText PropAcknowledged = System.Text.Json.JsonEncodedText.Encode("acknowledged"); + private static readonly System.Text.Json.JsonEncodedText PropPersistent = System.Text.Json.JsonEncodedText.Encode("persistent"); + private static readonly System.Text.Json.JsonEncodedText PropTransient = System.Text.Json.JsonEncodedText.Encode("transient"); + + public override Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsResponse Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) + { + reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propAcknowledged = default; + LocalJsonValue> propPersistent = default; + LocalJsonValue> propTransient = default; + while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) + { + if (propAcknowledged.TryReadProperty(ref reader, options, PropAcknowledged, null)) + { + continue; + } + + if (propPersistent.TryReadProperty(ref reader, options, PropPersistent, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, static object (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!)!)) + { + continue; + } + + if (propTransient.TryReadProperty(ref reader, options, PropTransient, static System.Collections.Generic.IReadOnlyDictionary (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadDictionaryValue(o, null, static object (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))!)!)) + { + continue; + } + + if (options.UnmappedMemberHandling is System.Text.Json.Serialization.JsonUnmappedMemberHandling.Skip) + { + reader.SafeSkip(); + continue; + } + + throw new System.Text.Json.JsonException($"Unknown JSON property '{reader.GetString()}' for type '{typeToConvert.Name}'."); + } + + reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); + return new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) + { + Acknowledged = propAcknowledged.Value, + Persistent = propPersistent.Value, + Transient = propTransient.Value + }; + } + + public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsResponse value, System.Text.Json.JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteProperty(options, PropAcknowledged, value.Acknowledged, null, null); + writer.WriteProperty(options, PropPersistent, value.Persistent, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, object v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))); + writer.WriteProperty(options, PropTransient, value.Transient, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, System.Collections.Generic.IReadOnlyDictionary v) => w.WriteDictionaryValue(o, v, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, object v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsResponse.g.cs new file mode 100644 index 00000000000..92cccfcbc8f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutClusterSettingsResponse.g.cs @@ -0,0 +1,55 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Linq; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Cluster; + +[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Cluster.Json.PutClusterSettingsResponseConverter))] +public sealed partial class PutClusterSettingsResponse : Elastic.Transport.Products.Elasticsearch.ElasticsearchResponse +{ + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PutClusterSettingsResponse() + { + } + + [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + internal PutClusterSettingsResponse(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel) + { + _ = sentinel; + } + + public +#if NET7_0_OR_GREATER +required +#endif +bool Acknowledged { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Persistent { get; set; } + public +#if NET7_0_OR_GREATER +required +#endif +System.Collections.Generic.IReadOnlyDictionary Transient { get; set; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs index ec41cd9d88f..e7486a52d15 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Cluster.g.cs @@ -682,6 +682,52 @@ public virtual Elastic.Clients.Elasticsearch.Cluster.PutComponentTemplateRespons return DoRequestAsync(request, cancellationToken); } + public virtual Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsResponse PutSettings(Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsResponse PutSettings() + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsResponse PutSettings(System.Action action) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequest(request); + } + + public virtual System.Threading.Tasks.Task PutSettingsAsync(Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequest request, System.Threading.CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutSettingsAsync(System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor(); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public virtual System.Threading.Tasks.Task PutSettingsAsync(System.Action action, System.Threading.CancellationToken cancellationToken = default) + { + var builder = new Elastic.Clients.Elasticsearch.Cluster.PutClusterSettingsRequestDescriptor(); + action.Invoke(builder); + var request = builder.Instance; + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + public virtual Elastic.Clients.Elasticsearch.Cluster.ClusterStatsResponse Stats(Elastic.Clients.Elasticsearch.Cluster.ClusterStatsRequest request) { request.BeforeRequest(); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs index fe40047d8bd..cd05e9a339c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Analyzers.g.cs @@ -552,7 +552,13 @@ public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Kuromoji(strin return this; } - public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Kuromoji(string key, System.Action action) + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Kuromoji(string key) + { + _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor.Build(null)); + return this; + } + + public Elastic.Clients.Elasticsearch.Analysis.AnalyzersDescriptor Kuromoji(string key, System.Action? action) { _items.Add(key, Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor.Build(action)); return this; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.Converters.g.cs index c97d230543f..50834e0a46c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.Converters.g.cs @@ -32,11 +32,11 @@ public sealed partial class KuromojiAnalyzerConverter : System.Text.Json.Seriali public override Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); - LocalJsonValue propMode = default; + LocalJsonValue propMode = default; LocalJsonValue propUserDictionary = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { - if (propMode.TryReadProperty(ref reader, options, PropMode, null)) + if (propMode.TryReadProperty(ref reader, options, PropMode, static Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadNullableValue(o))) { continue; } @@ -72,7 +72,7 @@ public override Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer Read(ref public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); - writer.WriteProperty(options, PropMode, value.Mode, null, null); + writer.WriteProperty(options, PropMode, value.Mode, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode? v) => w.WriteNullableValue(o, v)); writer.WriteProperty(options, PropType, value.Type, null, null); writer.WriteProperty(options, PropUserDictionary, value.UserDictionary, null, null); writer.WriteEndObject(); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs index 2bab4a43412..92557ff71d4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/KuromojiAnalyzer.g.cs @@ -26,18 +26,12 @@ namespace Elastic.Clients.Elasticsearch.Analysis; [System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.Json.KuromojiAnalyzerConverter))] public sealed partial class KuromojiAnalyzer : Elastic.Clients.Elasticsearch.Analysis.IAnalyzer { - [System.Diagnostics.CodeAnalysis.SetsRequiredMembers] - public KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode mode) - { - Mode = mode; - } #if NET7_0_OR_GREATER public KuromojiAnalyzer() { } #endif #if !NET7_0_OR_GREATER - [System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")] public KuromojiAnalyzer() { } @@ -48,11 +42,7 @@ internal KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstr _ = sentinel; } - public -#if NET7_0_OR_GREATER - required -#endif - Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode Mode { get; set; } + public Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode? Mode { get; set; } public string Type => "kuromoji"; @@ -78,7 +68,7 @@ public KuromojiAnalyzerDescriptor() public static explicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor(Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer instance) => new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor(instance); public static implicit operator Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor descriptor) => descriptor.Instance; - public Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode value) + public Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor Mode(Elastic.Clients.Elasticsearch.Analysis.KuromojiTokenizationMode? value) { Instance.Mode = value; return this; @@ -91,8 +81,13 @@ public Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor UserDic } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer Build(System.Action action) + internal static Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer Build(System.Action? action) { + if (action is null) + { + return new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance); + } + var builder = new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzerDescriptor(new Elastic.Clients.Elasticsearch.Analysis.KuromojiAnalyzer(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance)); action.Invoke(builder); return builder.Instance; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.Converters.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.Converters.g.cs index 4a9aefc6d37..e679eb54d9e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.Converters.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.Converters.g.cs @@ -25,6 +25,7 @@ namespace Elastic.Clients.Elasticsearch.Inference.Json; public sealed partial class CustomServiceSettingsConverter : System.Text.Json.Serialization.JsonConverter { + private static readonly System.Text.Json.JsonEncodedText PropBatchSize = System.Text.Json.JsonEncodedText.Encode("batch_size"); private static readonly System.Text.Json.JsonEncodedText PropHeaders = System.Text.Json.JsonEncodedText.Encode("headers"); private static readonly System.Text.Json.JsonEncodedText PropInputType = System.Text.Json.JsonEncodedText.Encode("input_type"); private static readonly System.Text.Json.JsonEncodedText PropQueryParameters = System.Text.Json.JsonEncodedText.Encode("query_parameters"); @@ -36,6 +37,7 @@ public sealed partial class CustomServiceSettingsConverter : System.Text.Json.Se public override Elastic.Clients.Elasticsearch.Inference.CustomServiceSettings Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { reader.ValidateToken(System.Text.Json.JsonTokenType.StartObject); + LocalJsonValue propBatchSize = default; LocalJsonValue propHeaders = default; LocalJsonValue propInputType = default; LocalJsonValue propQueryParameters = default; @@ -45,6 +47,11 @@ public override Elastic.Clients.Elasticsearch.Inference.CustomServiceSettings Re LocalJsonValue propUrl = default; while (reader.Read() && reader.TokenType is System.Text.Json.JsonTokenType.PropertyName) { + if (propBatchSize.TryReadProperty(ref reader, options, PropBatchSize, static int? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadNullableValue(o))) + { + continue; + } + if (propHeaders.TryReadProperty(ref reader, options, PropHeaders, static object? (ref System.Text.Json.Utf8JsonReader r, System.Text.Json.JsonSerializerOptions o) => r.ReadValueEx(o, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker)))) { continue; @@ -92,6 +99,7 @@ public override Elastic.Clients.Elasticsearch.Inference.CustomServiceSettings Re reader.ValidateToken(System.Text.Json.JsonTokenType.EndObject); return new Elastic.Clients.Elasticsearch.Inference.CustomServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance) { + BatchSize = propBatchSize.Value, Headers = propHeaders.Value, InputType = propInputType.Value, QueryParameters = propQueryParameters.Value, @@ -105,6 +113,7 @@ public override Elastic.Clients.Elasticsearch.Inference.CustomServiceSettings Re public override void Write(System.Text.Json.Utf8JsonWriter writer, Elastic.Clients.Elasticsearch.Inference.CustomServiceSettings value, System.Text.Json.JsonSerializerOptions options) { writer.WriteStartObject(); + writer.WriteProperty(options, PropBatchSize, value.BatchSize, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, int? v) => w.WriteNullableValue(o, v)); writer.WriteProperty(options, PropHeaders, value.Headers, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, object? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); writer.WriteProperty(options, PropInputType, value.InputType, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, object? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); writer.WriteProperty(options, PropQueryParameters, value.QueryParameters, null, static (System.Text.Json.Utf8JsonWriter w, System.Text.Json.JsonSerializerOptions o, object? v) => w.WriteValueEx(o, v, typeof(Elastic.Clients.Elasticsearch.Serialization.SourceMarker))); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.g.cs index 4b30f9d66e4..86189fce0ee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/CustomServiceSettings.g.cs @@ -52,7 +52,16 @@ internal CustomServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonC /// /// - /// Specifies the HTTPS header parameters – such as Authentication or Contet-Type – that are required to access the custom service. + /// Specifies the batch size used for the semantic_text field. If the field is not provided, the default is 10. + /// The batch size is the maximum number of inputs in a single request to the upstream service. + /// The chunk within the batch are controlled by the selected chunking strategy for the semantic_text field. + /// + /// + public int? BatchSize { get; set; } + + /// + /// + /// Specifies the HTTP header parameters – such as Authentication or Content-Type – that are required to access the custom service. /// For example: /// /// @@ -194,7 +203,20 @@ public CustomServiceSettingsDescriptor() /// /// - /// Specifies the HTTPS header parameters – such as Authentication or Contet-Type – that are required to access the custom service. + /// Specifies the batch size used for the semantic_text field. If the field is not provided, the default is 10. + /// The batch size is the maximum number of inputs in a single request to the upstream service. + /// The chunk within the batch are controlled by the selected chunking strategy for the semantic_text field. + /// + /// + public Elastic.Clients.Elasticsearch.Inference.CustomServiceSettingsDescriptor BatchSize(int? value) + { + Instance.BatchSize = value; + return this; + } + + /// + /// + /// Specifies the HTTP header parameters – such as Authentication or Content-Type – that are required to access the custom service. /// For example: /// ///