Skip to content

Commit

Permalink
Regenerate client using the latest specification (#8206) (#8208)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Bernd <git@flobernd.de>
  • Loading branch information
github-actions[bot] and flobernd committed May 29, 2024
1 parent 1bcfeee commit 04fb67a
Show file tree
Hide file tree
Showing 65 changed files with 3,822 additions and 702 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ namespace Elastic.Clients.Elasticsearch.Serverless.Cluster;

public sealed partial class PutComponentTemplateRequestParameters : RequestParameters
{
public string? Cause { get => Q<string?>("cause"); set => Q("cause", value); }

/// <summary>
/// <para>If `true`, this request cannot replace or update existing component templates.</para>
/// </summary>
Expand Down Expand Up @@ -65,9 +63,6 @@ public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Serverless.Name

internal override string OperationName => "cluster.put_component_template";

[JsonIgnore]
public string? Cause { get => Q<string?>("cause"); set => Q("cause", value); }

/// <summary>
/// <para>If `true`, this request cannot replace or update existing component templates.</para>
/// </summary>
Expand Down Expand Up @@ -128,7 +123,6 @@ public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Serve

internal override string OperationName => "cluster.put_component_template";

public PutComponentTemplateRequestDescriptor<TDocument> Cause(string? cause) => Qs("cause", cause);
public PutComponentTemplateRequestDescriptor<TDocument> Create(bool? create = true) => Qs("create", create);
public PutComponentTemplateRequestDescriptor<TDocument> MasterTimeout(Elastic.Clients.Elasticsearch.Serverless.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);

Expand Down Expand Up @@ -263,7 +257,6 @@ public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Serve

internal override string OperationName => "cluster.put_component_template";

public PutComponentTemplateRequestDescriptor Cause(string? cause) => Qs("cause", cause);
public PutComponentTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create);
public PutComponentTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Serverless.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public sealed partial class CreateResponse : ElasticsearchResponse
[JsonInclude, JsonPropertyName("result")]
public Elastic.Clients.Elasticsearch.Serverless.Result Result { get; init; }
[JsonInclude, JsonPropertyName("_seq_no")]
public long SeqNo { get; init; }
public long? SeqNo { get; init; }
[JsonInclude, JsonPropertyName("_shards")]
public Elastic.Clients.Elasticsearch.Serverless.ShardStatistics Shards { get; init; }
[JsonInclude, JsonPropertyName("_version")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public sealed partial class DeleteResponse : ElasticsearchResponse
[JsonInclude, JsonPropertyName("result")]
public Elastic.Clients.Elasticsearch.Serverless.Result Result { get; init; }
[JsonInclude, JsonPropertyName("_seq_no")]
public long SeqNo { get; init; }
public long? SeqNo { get; init; }
[JsonInclude, JsonPropertyName("_shards")]
public Elastic.Clients.Elasticsearch.Serverless.ShardStatistics Shards { get; init; }
[JsonInclude, JsonPropertyName("_version")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public sealed partial class CreateIndexRequestParameters : RequestParameters
public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("timeout"); set => Q("timeout", value); }

/// <summary>
/// <para>The number of shard copies that must be active before proceeding with the operation. <br/>Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).</para>
/// <para>The number of shard copies that must be active before proceeding with the operation.<br/>Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).</para>
/// </summary>
public Elastic.Clients.Elasticsearch.Serverless.WaitForActiveShards? WaitForActiveShards { get => Q<Elastic.Clients.Elasticsearch.Serverless.WaitForActiveShards?>("wait_for_active_shards"); set => Q("wait_for_active_shards", value); }
}
Expand Down Expand Up @@ -77,7 +77,7 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.Serverless.IndexName ind
public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("timeout"); set => Q("timeout", value); }

/// <summary>
/// <para>The number of shard copies that must be active before proceeding with the operation. <br/>Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).</para>
/// <para>The number of shard copies that must be active before proceeding with the operation.<br/>Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).</para>
/// </summary>
[JsonIgnore]
public Elastic.Clients.Elasticsearch.Serverless.WaitForActiveShards? WaitForActiveShards { get => Q<Elastic.Clients.Elasticsearch.Serverless.WaitForActiveShards?>("wait_for_active_shards"); set => Q("wait_for_active_shards", value); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Serverless.Name name) :
/// <para>Configuration options for the index.</para>
/// </summary>
[JsonInclude, JsonPropertyName("settings")]
public IDictionary<string, object>? Settings { get; set; }
public Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? Settings { get; set; }

/// <summary>
/// <para>Version number used to manage index templates externally. This number<br/>is not automatically generated by Elasticsearch.</para>
Expand Down Expand Up @@ -150,7 +150,9 @@ public PutTemplateRequestDescriptor<TDocument> Name(Elastic.Clients.Elasticsearc
private Elastic.Clients.Elasticsearch.Serverless.Mapping.TypeMappingDescriptor<TDocument> MappingsDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.Mapping.TypeMappingDescriptor<TDocument>> MappingsDescriptorAction { get; set; }
private int? OrderValue { get; set; }
private IDictionary<string, object>? SettingsValue { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? SettingsValue { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor<TDocument> SettingsDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor<TDocument>> SettingsDescriptorAction { get; set; }
private long? VersionValue { get; set; }

/// <summary>
Expand Down Expand Up @@ -211,9 +213,27 @@ public PutTemplateRequestDescriptor<TDocument> Order(int? order)
/// <summary>
/// <para>Configuration options for the index.</para>
/// </summary>
public PutTemplateRequestDescriptor<TDocument> Settings(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> selector)
public PutTemplateRequestDescriptor<TDocument> Settings(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? settings)
{
SettingsValue = selector?.Invoke(new FluentDictionary<string, object>());
SettingsDescriptor = null;
SettingsDescriptorAction = null;
SettingsValue = settings;
return Self;
}

public PutTemplateRequestDescriptor<TDocument> Settings(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor<TDocument> descriptor)
{
SettingsValue = null;
SettingsDescriptorAction = null;
SettingsDescriptor = descriptor;
return Self;
}

public PutTemplateRequestDescriptor<TDocument> Settings(Action<Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor<TDocument>> configure)
{
SettingsValue = null;
SettingsDescriptor = null;
SettingsDescriptorAction = configure;
return Self;
}

Expand Down Expand Up @@ -263,7 +283,17 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
writer.WriteNumberValue(OrderValue.Value);
}

if (SettingsValue is not null)
if (SettingsDescriptor is not null)
{
writer.WritePropertyName("settings");
JsonSerializer.Serialize(writer, SettingsDescriptor, options);
}
else if (SettingsDescriptorAction is not null)
{
writer.WritePropertyName("settings");
JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor<TDocument>(SettingsDescriptorAction), options);
}
else if (SettingsValue is not null)
{
writer.WritePropertyName("settings");
JsonSerializer.Serialize(writer, SettingsValue, options);
Expand Down Expand Up @@ -314,7 +344,9 @@ public PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverles
private Elastic.Clients.Elasticsearch.Serverless.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.Mapping.TypeMappingDescriptor> MappingsDescriptorAction { get; set; }
private int? OrderValue { get; set; }
private IDictionary<string, object>? SettingsValue { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? SettingsValue { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor> SettingsDescriptorAction { get; set; }
private long? VersionValue { get; set; }

/// <summary>
Expand Down Expand Up @@ -375,9 +407,27 @@ public PutTemplateRequestDescriptor Order(int? order)
/// <summary>
/// <para>Configuration options for the index.</para>
/// </summary>
public PutTemplateRequestDescriptor Settings(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> selector)
public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? settings)
{
SettingsValue = selector?.Invoke(new FluentDictionary<string, object>());
SettingsDescriptor = null;
SettingsDescriptorAction = null;
SettingsValue = settings;
return Self;
}

public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor descriptor)
{
SettingsValue = null;
SettingsDescriptorAction = null;
SettingsDescriptor = descriptor;
return Self;
}

public PutTemplateRequestDescriptor Settings(Action<Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor> configure)
{
SettingsValue = null;
SettingsDescriptor = null;
SettingsDescriptorAction = configure;
return Self;
}

Expand Down Expand Up @@ -427,7 +477,17 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
writer.WriteNumberValue(OrderValue.Value);
}

if (SettingsValue is not null)
if (SettingsDescriptor is not null)
{
writer.WritePropertyName("settings");
JsonSerializer.Serialize(writer, SettingsDescriptor, options);
}
else if (SettingsDescriptorAction is not null)
{
writer.WritePropertyName("settings");
JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options);
}
else if (SettingsValue is not null)
{
writer.WritePropertyName("settings");
JsonSerializer.Serialize(writer, SettingsValue, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public sealed partial class IndexResponse : ElasticsearchResponse
[JsonInclude, JsonPropertyName("result")]
public Elastic.Clients.Elasticsearch.Serverless.Result Result { get; init; }
[JsonInclude, JsonPropertyName("_seq_no")]
public long SeqNo { get; init; }
public long? SeqNo { get; init; }
[JsonInclude, JsonPropertyName("_shards")]
public Elastic.Clients.Elasticsearch.Serverless.ShardStatistics Shards { get; init; }
[JsonInclude, JsonPropertyName("_version")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ public override SearchRequest Read(ref Utf8JsonReader reader, Type typeToConvert
continue;
}

if (property == "retriever")
{
variant.Retriever = JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Retriever?>(ref reader, options);
continue;
}

if (property == "runtime_mappings")
{
variant.RuntimeMappings = JsonSerializer.Deserialize<IDictionary<Elastic.Clients.Elasticsearch.Serverless.Field, Elastic.Clients.Elasticsearch.Serverless.Mapping.RuntimeField>?>(ref reader, options);
Expand Down Expand Up @@ -497,6 +503,12 @@ public override void Write(Utf8JsonWriter writer, SearchRequest value, JsonSeria
JsonSerializer.Serialize(writer, value.Rescore, options);
}

if (value.Retriever is not null)
{
writer.WritePropertyName("retriever");
JsonSerializer.Serialize(writer, value.Retriever, options);
}

if (value.RuntimeMappings is not null)
{
writer.WritePropertyName("runtime_mappings");
Expand Down Expand Up @@ -897,6 +909,12 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Serverless.Indices? indices)
[SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.Core.Search.Rescore))]
public ICollection<Elastic.Clients.Elasticsearch.Serverless.Core.Search.Rescore>? Rescore { get; set; }

/// <summary>
/// <para>A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such as query and knn.</para>
/// </summary>
[JsonInclude, JsonPropertyName("retriever")]
public Elastic.Clients.Elasticsearch.Serverless.Retriever? Retriever { get; set; }

/// <summary>
/// <para>Defines one or more runtime fields in the search request.<br/>These fields take precedence over mapped fields with the same name.</para>
/// </summary>
Expand Down Expand Up @@ -1096,6 +1114,9 @@ public SearchRequestDescriptor<TDocument> Indices(Elastic.Clients.Elasticsearch.
private Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor<TDocument> RescoreDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor<TDocument>> RescoreDescriptorAction { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor<TDocument>>[] RescoreDescriptorActions { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.Retriever? RetrieverValue { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor<TDocument> RetrieverDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor<TDocument>> RetrieverDescriptorAction { get; set; }
private IDictionary<Elastic.Clients.Elasticsearch.Serverless.Field, Elastic.Clients.Elasticsearch.Serverless.Mapping.RuntimeFieldDescriptor<TDocument>> RuntimeMappingsValue { get; set; }
private IDictionary<string, Elastic.Clients.Elasticsearch.Serverless.ScriptFieldDescriptor> ScriptFieldsValue { get; set; }
private ICollection<Elastic.Clients.Elasticsearch.Serverless.FieldValue>? SearchAfterValue { get; set; }
Expand Down Expand Up @@ -1501,6 +1522,33 @@ public SearchRequestDescriptor<TDocument> Rescore(params Action<Elastic.Clients.
return Self;
}

/// <summary>
/// <para>A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such as query and knn.</para>
/// </summary>
public SearchRequestDescriptor<TDocument> Retriever(Elastic.Clients.Elasticsearch.Serverless.Retriever? retriever)
{
RetrieverDescriptor = null;
RetrieverDescriptorAction = null;
RetrieverValue = retriever;
return Self;
}

public SearchRequestDescriptor<TDocument> Retriever(Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor<TDocument> descriptor)
{
RetrieverValue = null;
RetrieverDescriptorAction = null;
RetrieverDescriptor = descriptor;
return Self;
}

public SearchRequestDescriptor<TDocument> Retriever(Action<Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor<TDocument>> configure)
{
RetrieverValue = null;
RetrieverDescriptor = null;
RetrieverDescriptorAction = configure;
return Self;
}

/// <summary>
/// <para>Defines one or more runtime fields in the search request.<br/>These fields take precedence over mapped fields with the same name.</para>
/// </summary>
Expand Down Expand Up @@ -1972,6 +2020,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
SingleOrManySerializationHelper.Serialize<Elastic.Clients.Elasticsearch.Serverless.Core.Search.Rescore>(RescoreValue, writer, options);
}

if (RetrieverDescriptor is not null)
{
writer.WritePropertyName("retriever");
JsonSerializer.Serialize(writer, RetrieverDescriptor, options);
}
else if (RetrieverDescriptorAction is not null)
{
writer.WritePropertyName("retriever");
JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor<TDocument>(RetrieverDescriptorAction), options);
}
else if (RetrieverValue is not null)
{
writer.WritePropertyName("retriever");
JsonSerializer.Serialize(writer, RetrieverValue, options);
}

if (RuntimeMappingsValue is not null)
{
writer.WritePropertyName("runtime_mappings");
Expand Down Expand Up @@ -2215,6 +2279,9 @@ public SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Serverless.
private Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor> RescoreDescriptorAction { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor>[] RescoreDescriptorActions { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.Retriever? RetrieverValue { get; set; }
private Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor RetrieverDescriptor { get; set; }
private Action<Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor> RetrieverDescriptorAction { get; set; }
private IDictionary<Elastic.Clients.Elasticsearch.Serverless.Field, Elastic.Clients.Elasticsearch.Serverless.Mapping.RuntimeFieldDescriptor> RuntimeMappingsValue { get; set; }
private IDictionary<string, Elastic.Clients.Elasticsearch.Serverless.ScriptFieldDescriptor> ScriptFieldsValue { get; set; }
private ICollection<Elastic.Clients.Elasticsearch.Serverless.FieldValue>? SearchAfterValue { get; set; }
Expand Down Expand Up @@ -2620,6 +2687,33 @@ public SearchRequestDescriptor Rescore(params Action<Elastic.Clients.Elasticsear
return Self;
}

/// <summary>
/// <para>A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that also return top documents such as query and knn.</para>
/// </summary>
public SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.Serverless.Retriever? retriever)
{
RetrieverDescriptor = null;
RetrieverDescriptorAction = null;
RetrieverValue = retriever;
return Self;
}

public SearchRequestDescriptor Retriever(Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor descriptor)
{
RetrieverValue = null;
RetrieverDescriptorAction = null;
RetrieverDescriptor = descriptor;
return Self;
}

public SearchRequestDescriptor Retriever(Action<Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor> configure)
{
RetrieverValue = null;
RetrieverDescriptor = null;
RetrieverDescriptorAction = configure;
return Self;
}

/// <summary>
/// <para>Defines one or more runtime fields in the search request.<br/>These fields take precedence over mapped fields with the same name.</para>
/// </summary>
Expand Down Expand Up @@ -3091,6 +3185,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o
SingleOrManySerializationHelper.Serialize<Elastic.Clients.Elasticsearch.Serverless.Core.Search.Rescore>(RescoreValue, writer, options);
}

if (RetrieverDescriptor is not null)
{
writer.WritePropertyName("retriever");
JsonSerializer.Serialize(writer, RetrieverDescriptor, options);
}
else if (RetrieverDescriptorAction is not null)
{
writer.WritePropertyName("retriever");
JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor(RetrieverDescriptorAction), options);
}
else if (RetrieverValue is not null)
{
writer.WritePropertyName("retriever");
JsonSerializer.Serialize(writer, RetrieverValue, options);
}

if (RuntimeMappingsValue is not null)
{
writer.WritePropertyName("runtime_mappings");
Expand Down
Loading

0 comments on commit 04fb67a

Please sign in to comment.