From 17a3a9f46d1f9799bbcc5a77c1ccafdc303006cc Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Wed, 29 May 2024 10:55:35 +0200 Subject: [PATCH] Regenerate client using the latest specification --- .../Cluster/PutComponentTemplateRequest.g.cs | 7 - .../_Generated/Api/CreateResponse.g.cs | 2 +- .../_Generated/Api/DeleteResponse.g.cs | 2 +- .../IndexManagement/CreateIndexRequest.g.cs | 4 +- .../IndexManagement/PutTemplateRequest.g.cs | 78 +- .../_Generated/Api/IndexResponse.g.cs | 2 +- .../_Generated/Api/SearchRequest.g.cs | 110 +++ .../Api/Synonyms/PutSynonymResponse.g.cs | 2 +- .../_Generated/Api/UpdateResponse.g.cs | 2 +- .../AdjacencyMatrixAggregation.g.cs | 38 + .../Types/Aggregations/AggregationRange.g.cs | 20 +- .../Types/Analysis/Normalizers.g.cs | 3 +- .../Types/Analysis/PhoneticTokenFilter.g.cs | 3 +- .../_Generated/Types/Enums/Enums.Mapping.g.cs | 7 + .../Types/Ingest/RemoveProcessor.g.cs | 39 + .../_Generated/Types/KnnQuery.g.cs | 10 +- .../_Generated/Types/KnnRetriever.g.cs | 480 +++++++++++++ .../_Generated/Types/KnnSearch.g.cs | 20 +- .../Types/Mapping/DenseVectorProperty.g.cs | 30 + .../Types/Mapping/DynamicTemplate.g.cs | 415 +++++++++-- .../Types/Mapping/KeywordProperty.g.cs | 60 ++ .../_Generated/Types/QueryDsl/Query.g.cs | 30 +- .../Types/QueryDsl/SpanFieldMaskingQuery.g.cs | 4 +- .../_Generated/Types/QueryDsl/SpanQuery.g.cs | 24 +- .../_Generated/Types/RRFRetriever.g.cs | 446 ++++++++++++ .../_Generated/Types/Retriever.g.cs | 257 +++++++ .../_Generated/Types/StandardRetriever.g.cs | 677 ++++++++++++++++++ .../_Generated/Api/ApiUrlLookup.g.cs | 7 +- .../Cluster/PutComponentTemplateRequest.g.cs | 7 - .../_Generated/Api/CreateResponse.g.cs | 2 +- .../_Generated/Api/DeleteResponse.g.cs | 2 +- .../_Generated/Api/Esql/EsqlQueryRequest.g.cs | 30 - .../IndexManagement/CreateIndexRequest.g.cs | 4 +- .../IndexManagement/PutTemplateRequest.g.cs | 78 +- .../_Generated/Api/IndexResponse.g.cs | 2 +- ...quest.g.cs => DeleteInferenceRequest.g.cs} | 32 +- ...onse.g.cs => DeleteInferenceResponse.g.cs} | 2 +- ...lRequest.g.cs => GetInferenceRequest.g.cs} | 34 +- ...esponse.g.cs => GetInferenceResponse.g.cs} | 6 +- .../Api/Inference/InferenceRequest.g.cs | 4 +- .../Api/Inference/PutInferenceRequest.g.cs | 127 ++++ ...esponse.g.cs => PutInferenceResponse.g.cs} | 12 +- .../Api/Inference/PutModelRequest.g.cs | 127 ---- .../UpdateTrainedModelDeploymentRequest.g.cs | 107 +++ ...UpdateTrainedModelDeploymentResponse.g.cs} | 48 +- .../Api/Synonyms/PutSynonymResponse.g.cs | 2 +- .../_Generated/Api/UpdateResponse.g.cs | 2 +- .../Client/ElasticsearchClient.Inference.g.cs | 288 ++++---- .../Client/ElasticsearchClient.Ml.g.cs | 90 +++ .../AdjacencyMatrixAggregation.g.cs | 38 + .../Types/Aggregations/AggregationRange.g.cs | 20 +- .../Types/Analysis/Normalizers.g.cs | 3 +- .../Types/Analysis/PhoneticTokenFilter.g.cs | 3 +- .../_Generated/Types/Enums/Enums.Mapping.g.cs | 7 + ...odelConfig.g.cs => InferenceEndpoint.g.cs} | 22 +- ...tainer.g.cs => InferenceEndpointInfo.g.cs} | 14 +- .../Types/Ingest/RemoveProcessor.g.cs | 39 + .../_Generated/Types/KnnQuery.g.cs | 10 +- .../_Generated/Types/KnnSearch.g.cs | 20 +- .../Types/Mapping/DenseVectorProperty.g.cs | 30 + .../Types/Mapping/DynamicTemplate.g.cs | 415 +++++++++-- .../Types/Mapping/KeywordProperty.g.cs | 60 ++ .../_Generated/Types/QueryDsl/Query.g.cs | 30 +- .../Types/QueryDsl/SpanFieldMaskingQuery.g.cs | 4 +- .../_Generated/Types/QueryDsl/SpanQuery.g.cs | 24 +- 65 files changed, 3822 insertions(+), 702 deletions(-) create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnRetriever.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/RRFRetriever.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Retriever.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/StandardRetriever.g.cs rename src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/{DeleteModelRequest.g.cs => DeleteInferenceRequest.g.cs} (58%) rename src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/{DeleteModelResponse.g.cs => DeleteInferenceResponse.g.cs} (95%) rename src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/{GetModelRequest.g.cs => GetInferenceRequest.g.cs} (57%) rename src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/{GetModelResponse.g.cs => GetInferenceResponse.g.cs} (89%) create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs rename src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/{PutModelResponse.g.cs => PutInferenceResponse.g.cs} (87%) delete mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutModelRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs rename src/Elastic.Clients.Elasticsearch/_Generated/{Types/Enums/Enums.Esql.g.cs => Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs} (56%) rename src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/{ModelConfig.g.cs => InferenceEndpoint.g.cs} (78%) rename src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/{ModelConfigContainer.g.cs => InferenceEndpointInfo.g.cs} (85%) diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs index fc112ea6a33..9af2ef31586 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs @@ -31,8 +31,6 @@ namespace Elastic.Clients.Elasticsearch.Serverless.Cluster; public sealed partial class PutComponentTemplateRequestParameters : RequestParameters { - public string? Cause { get => Q("cause"); set => Q("cause", value); } - /// /// If `true`, this request cannot replace or update existing component templates. /// @@ -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("cause"); set => Q("cause", value); } - /// /// If `true`, this request cannot replace or update existing component templates. /// @@ -128,7 +123,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); @@ -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); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/CreateResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/CreateResponse.g.cs index 8a17e893b80..17ad3a8848c 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/CreateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/CreateResponse.g.cs @@ -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")] diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/DeleteResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/DeleteResponse.g.cs index 8d7c61570b4..14f7602e577 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/DeleteResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/DeleteResponse.g.cs @@ -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")] diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs index aa58f533c64..c71e9c3cd8b 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs @@ -42,7 +42,7 @@ public sealed partial class CreateIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// - /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
+ /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
///
public Elastic.Clients.Elasticsearch.Serverless.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } @@ -77,7 +77,7 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.Serverless.IndexName ind public Elastic.Clients.Elasticsearch.Serverless.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// - /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
+ /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
///
[JsonIgnore] public Elastic.Clients.Elasticsearch.Serverless.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs index 314e4bed7c2..9c03c96df9f 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs @@ -106,7 +106,7 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Serverless.Name name) : /// Configuration options for the index. /// [JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } + public Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? Settings { get; set; } /// /// Version number used to manage index templates externally. This number
is not automatically generated by Elasticsearch.
@@ -150,7 +150,9 @@ public PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearc private Elastic.Clients.Elasticsearch.Serverless.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } private Action> MappingsDescriptorAction { get; set; } private int? OrderValue { get; set; } - private IDictionary? 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> SettingsDescriptorAction { get; set; } private long? VersionValue { get; set; } /// @@ -211,9 +213,27 @@ public PutTemplateRequestDescriptor Order(int? order) /// /// Configuration options for the index. /// - public PutTemplateRequestDescriptor Settings(Func, FluentDictionary> selector) + public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? settings) { - SettingsValue = selector?.Invoke(new FluentDictionary()); + 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> configure) + { + SettingsValue = null; + SettingsDescriptor = null; + SettingsDescriptorAction = configure; return Self; } @@ -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(SettingsDescriptorAction), options); + } + else if (SettingsValue is not null) { writer.WritePropertyName("settings"); JsonSerializer.Serialize(writer, SettingsValue, options); @@ -314,7 +344,9 @@ public PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverles private Elastic.Clients.Elasticsearch.Serverless.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } private Action MappingsDescriptorAction { get; set; } private int? OrderValue { get; set; } - private IDictionary? 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 SettingsDescriptorAction { get; set; } private long? VersionValue { get; set; } /// @@ -375,9 +407,27 @@ public PutTemplateRequestDescriptor Order(int? order) /// /// Configuration options for the index. /// - public PutTemplateRequestDescriptor Settings(Func, FluentDictionary> selector) + public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexSettings? settings) { - SettingsValue = selector?.Invoke(new FluentDictionary()); + 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 configure) + { + SettingsValue = null; + SettingsDescriptor = null; + SettingsDescriptorAction = configure; return Self; } @@ -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); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexResponse.g.cs index 09eb78e87ac..ce056a65bd4 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/IndexResponse.g.cs @@ -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")] diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/SearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/SearchRequest.g.cs index c21b70a97ed..32a77cf91c9 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/SearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/SearchRequest.g.cs @@ -291,6 +291,12 @@ public override SearchRequest Read(ref Utf8JsonReader reader, Type typeToConvert continue; } + if (property == "retriever") + { + variant.Retriever = JsonSerializer.Deserialize(ref reader, options); + continue; + } + if (property == "runtime_mappings") { variant.RuntimeMappings = JsonSerializer.Deserialize?>(ref reader, options); @@ -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"); @@ -897,6 +909,12 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Serverless.Indices? indices) [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.Core.Search.Rescore))] public ICollection? Rescore { get; set; } + /// + /// 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. + /// + [JsonInclude, JsonPropertyName("retriever")] + public Elastic.Clients.Elasticsearch.Serverless.Retriever? Retriever { get; set; } + /// /// Defines one or more runtime fields in the search request.
These fields take precedence over mapped fields with the same name.
///
@@ -1096,6 +1114,9 @@ public SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch. private Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } private Action> RescoreDescriptorAction { get; set; } private Action>[] RescoreDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Retriever? RetrieverValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor RetrieverDescriptor { get; set; } + private Action> RetrieverDescriptorAction { get; set; } private IDictionary> RuntimeMappingsValue { get; set; } private IDictionary ScriptFieldsValue { get; set; } private ICollection? SearchAfterValue { get; set; } @@ -1501,6 +1522,33 @@ public SearchRequestDescriptor Rescore(params Action + /// 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. + ///
+ 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> configure) + { + RetrieverValue = null; + RetrieverDescriptor = null; + RetrieverDescriptorAction = configure; + return Self; + } + /// /// Defines one or more runtime fields in the search request.
These fields take precedence over mapped fields with the same name.
///
@@ -1972,6 +2020,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o SingleOrManySerializationHelper.Serialize(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"); @@ -2215,6 +2279,9 @@ public SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Serverless. private Elastic.Clients.Elasticsearch.Serverless.Core.Search.RescoreDescriptor RescoreDescriptor { get; set; } private Action RescoreDescriptorAction { get; set; } private Action[] RescoreDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Retriever? RetrieverValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor RetrieverDescriptor { get; set; } + private Action RetrieverDescriptorAction { get; set; } private IDictionary RuntimeMappingsValue { get; set; } private IDictionary ScriptFieldsValue { get; set; } private ICollection? SearchAfterValue { get; set; } @@ -2620,6 +2687,33 @@ public SearchRequestDescriptor Rescore(params Action + /// 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. + ///
+ 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 configure) + { + RetrieverValue = null; + RetrieverDescriptor = null; + RetrieverDescriptorAction = configure; + return Self; + } + /// /// Defines one or more runtime fields in the search request.
These fields take precedence over mapped fields with the same name.
///
@@ -3091,6 +3185,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o SingleOrManySerializationHelper.Serialize(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"); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Synonyms/PutSynonymResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Synonyms/PutSynonymResponse.g.cs index 92df385340c..7d199169ef8 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Synonyms/PutSynonymResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Synonyms/PutSynonymResponse.g.cs @@ -29,7 +29,7 @@ namespace Elastic.Clients.Elasticsearch.Serverless.Synonyms; public sealed partial class PutSynonymResponse : ElasticsearchResponse { [JsonInclude, JsonPropertyName("reload_analyzers_details")] - public Elastic.Clients.Elasticsearch.Serverless.IndexManagement.ReloadDetails ReloadAnalyzersDetails { get; init; } + public Elastic.Clients.Elasticsearch.Serverless.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; init; } [JsonInclude, JsonPropertyName("result")] public Elastic.Clients.Elasticsearch.Serverless.Result Result { get; init; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/UpdateResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/UpdateResponse.g.cs index 72d2d8ba209..d25c3fdaaf5 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/UpdateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/UpdateResponse.g.cs @@ -41,7 +41,7 @@ public sealed partial class UpdateResponse : 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")] diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs index 1b24c7c2168..358c99afac9 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs @@ -35,6 +35,12 @@ public sealed partial class AdjacencyMatrixAggregation [JsonInclude, JsonPropertyName("filters")] public IDictionary? Filters { get; set; } + /// + /// Separator used to concatenate filter names. Defaults to &. + /// + [JsonInclude, JsonPropertyName("separator")] + public string? Separator { get; set; } + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(AdjacencyMatrixAggregation adjacencyMatrixAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.AdjacencyMatrix(adjacencyMatrixAggregation); } @@ -47,6 +53,7 @@ public AdjacencyMatrixAggregationDescriptor() : base() } private IDictionary> FiltersValue { get; set; } + private string? SeparatorValue { get; set; } /// /// Filters used to create buckets.
At least one filter is required.
@@ -57,6 +64,15 @@ public AdjacencyMatrixAggregationDescriptor Filters(Func + /// Separator used to concatenate filter names. Defaults to &. + ///
+ public AdjacencyMatrixAggregationDescriptor Separator(string? separator) + { + SeparatorValue = separator; + return Self; + } + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -66,6 +82,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, FiltersValue, options); } + if (!string.IsNullOrEmpty(SeparatorValue)) + { + writer.WritePropertyName("separator"); + writer.WriteStringValue(SeparatorValue); + } + writer.WriteEndObject(); } } @@ -79,6 +101,7 @@ public AdjacencyMatrixAggregationDescriptor() : base() } private IDictionary FiltersValue { get; set; } + private string? SeparatorValue { get; set; } /// /// Filters used to create buckets.
At least one filter is required.
@@ -89,6 +112,15 @@ public AdjacencyMatrixAggregationDescriptor Filters(Func + /// Separator used to concatenate filter names. Defaults to &. + ///
+ public AdjacencyMatrixAggregationDescriptor Separator(string? separator) + { + SeparatorValue = separator; + return Self; + } + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -98,6 +130,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, FiltersValue, options); } + if (!string.IsNullOrEmpty(SeparatorValue)) + { + writer.WritePropertyName("separator"); + writer.WriteStringValue(SeparatorValue); + } + writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AggregationRange.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AggregationRange.g.cs index f58364f948a..ce9601dcbaa 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AggregationRange.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/AggregationRange.g.cs @@ -33,7 +33,7 @@ public sealed partial class AggregationRange /// Start of the range (inclusive). ///
[JsonInclude, JsonPropertyName("from")] - public object? From { get; set; } + public double? From { get; set; } /// /// Custom key to return the range with. @@ -45,7 +45,7 @@ public sealed partial class AggregationRange /// End of the range (exclusive). /// [JsonInclude, JsonPropertyName("to")] - public object? To { get; set; } + public double? To { get; set; } } public sealed partial class AggregationRangeDescriptor : SerializableDescriptor @@ -56,14 +56,14 @@ public AggregationRangeDescriptor() : base() { } - private object? FromValue { get; set; } + private double? FromValue { get; set; } private string? KeyValue { get; set; } - private object? ToValue { get; set; } + private double? ToValue { get; set; } /// /// Start of the range (inclusive). /// - public AggregationRangeDescriptor From(object? from) + public AggregationRangeDescriptor From(double? from) { FromValue = from; return Self; @@ -81,7 +81,7 @@ public AggregationRangeDescriptor Key(string? key) /// /// End of the range (exclusive). /// - public AggregationRangeDescriptor To(object? to) + public AggregationRangeDescriptor To(double? to) { ToValue = to; return Self; @@ -90,10 +90,10 @@ public AggregationRangeDescriptor To(object? to) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - if (FromValue is not null) + if (FromValue.HasValue) { writer.WritePropertyName("from"); - JsonSerializer.Serialize(writer, FromValue, options); + writer.WriteNumberValue(FromValue.Value); } if (!string.IsNullOrEmpty(KeyValue)) @@ -102,10 +102,10 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(KeyValue); } - if (ToValue is not null) + if (ToValue.HasValue) { writer.WritePropertyName("to"); - JsonSerializer.Serialize(writer, ToValue, options); + writer.WriteNumberValue(ToValue.Value); } writer.WriteEndObject(); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/Normalizers.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/Normalizers.g.cs index ec1ee4b7fa0..c04f91ef0d3 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/Normalizers.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/Normalizers.g.cs @@ -93,8 +93,7 @@ public override INormalizer Read(ref Utf8JsonReader reader, Type typeToConvert, case "lowercase": return JsonSerializer.Deserialize(ref reader, options); default: - ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(INormalizer)); - return null; + return JsonSerializer.Deserialize(ref reader, options); } } diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs index 31a8a198a1e..e5d6c3f9add 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs @@ -32,6 +32,7 @@ public sealed partial class PhoneticTokenFilter : ITokenFilter [JsonInclude, JsonPropertyName("encoder")] public Elastic.Clients.Elasticsearch.Serverless.Analysis.PhoneticEncoder Encoder { get; set; } [JsonInclude, JsonPropertyName("languageset")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.PhoneticLanguage))] public ICollection Languageset { get; set; } [JsonInclude, JsonPropertyName("max_code_len")] public int? MaxCodeLen { get; set; } @@ -113,7 +114,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WritePropertyName("encoder"); JsonSerializer.Serialize(writer, EncoderValue, options); writer.WritePropertyName("languageset"); - JsonSerializer.Serialize(writer, LanguagesetValue, options); + SingleOrManySerializationHelper.Serialize(LanguagesetValue, writer, options); if (MaxCodeLenValue.HasValue) { writer.WritePropertyName("max_code_len"); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Mapping.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Mapping.g.cs index 644984391d3..c4a563fdde8 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Mapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Mapping.g.cs @@ -87,6 +87,8 @@ public override void Write(Utf8JsonWriter writer, DynamicMapping value, JsonSeri [JsonConverter(typeof(FieldTypeConverter))] public enum FieldType { + [EnumMember(Value = "version")] + Version, [EnumMember(Value = "token_count")] TokenCount, [EnumMember(Value = "text")] @@ -182,6 +184,8 @@ public override FieldType Read(ref Utf8JsonReader reader, Type typeToConvert, Js var enumString = reader.GetString(); switch (enumString) { + case "version": + return FieldType.Version; case "token_count": return FieldType.TokenCount; case "text": @@ -278,6 +282,9 @@ public override void Write(Utf8JsonWriter writer, FieldType value, JsonSerialize { switch (value) { + case FieldType.Version: + writer.WriteStringValue("version"); + return; case FieldType.TokenCount: writer.WriteStringValue("token_count"); return; diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Ingest/RemoveProcessor.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Ingest/RemoveProcessor.g.cs index 62a47999ca0..d81557b9b83 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Ingest/RemoveProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Ingest/RemoveProcessor.g.cs @@ -60,6 +60,13 @@ public sealed partial class RemoveProcessor [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + [JsonInclude, JsonPropertyName("keep")] + [JsonConverter(typeof(SingleOrManyFieldsConverter))] + public Elastic.Clients.Elasticsearch.Serverless.Fields? Keep { get; set; } + /// /// Handle failures for the processor. /// @@ -88,6 +95,7 @@ public RemoveProcessorDescriptor() : base() private string? IfValue { get; set; } private bool? IgnoreFailureValue { get; set; } private bool? IgnoreMissingValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Fields? KeepValue { get; set; } private ICollection? OnFailureValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } private Action> OnFailureDescriptorAction { get; set; } @@ -139,6 +147,15 @@ public RemoveProcessorDescriptor IgnoreMissing(bool? ignoreMissing = return Self; } + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + public RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Serverless.Fields? keep) + { + KeepValue = keep; + return Self; + } + /// /// Handle failures for the processor. /// @@ -216,6 +233,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteBooleanValue(IgnoreMissingValue.Value); } + if (KeepValue is not null) + { + writer.WritePropertyName("keep"); + JsonSerializer.Serialize(writer, KeepValue, options); + } + if (OnFailureDescriptor is not null) { writer.WritePropertyName("on_failure"); @@ -270,6 +293,7 @@ public RemoveProcessorDescriptor() : base() private string? IfValue { get; set; } private bool? IgnoreFailureValue { get; set; } private bool? IgnoreMissingValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Fields? KeepValue { get; set; } private ICollection? OnFailureValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } private Action OnFailureDescriptorAction { get; set; } @@ -321,6 +345,15 @@ public RemoveProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) return Self; } + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + public RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Serverless.Fields? keep) + { + KeepValue = keep; + return Self; + } + /// /// Handle failures for the processor. /// @@ -398,6 +431,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteBooleanValue(IgnoreMissingValue.Value); } + if (KeepValue is not null) + { + writer.WritePropertyName("keep"); + JsonSerializer.Serialize(writer, KeepValue, options); + } + if (OnFailureDescriptor is not null) { writer.WritePropertyName("on_failure"); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnQuery.g.cs index 17d32c7a5ea..3fde80b3a14 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnQuery.g.cs @@ -52,7 +52,7 @@ public sealed partial class KnnQuery /// The number of nearest neighbor candidates to consider per shard /// [JsonInclude, JsonPropertyName("num_candidates")] - public long? NumCandidates { get; set; } + public int? NumCandidates { get; set; } [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } @@ -91,7 +91,7 @@ public KnnQueryDescriptor() : base() private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } private Action> FilterDescriptorAction { get; set; } private Action>[] FilterDescriptorActions { get; set; } - private long? NumCandidatesValue { get; set; } + private int? NumCandidatesValue { get; set; } private string? QueryNameValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } @@ -177,7 +177,7 @@ public KnnQueryDescriptor Filter(params Action /// The number of nearest neighbor candidates to consider per shard /// - public KnnQueryDescriptor NumCandidates(long? numCandidates) + public KnnQueryDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; @@ -332,7 +332,7 @@ public KnnQueryDescriptor() : base() private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } private Action FilterDescriptorAction { get; set; } private Action[] FilterDescriptorActions { get; set; } - private long? NumCandidatesValue { get; set; } + private int? NumCandidatesValue { get; set; } private string? QueryNameValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } @@ -418,7 +418,7 @@ public KnnQueryDescriptor Filter(params Action /// The number of nearest neighbor candidates to consider per shard /// - public KnnQueryDescriptor NumCandidates(long? numCandidates) + public KnnQueryDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnRetriever.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnRetriever.g.cs new file mode 100644 index 00000000000..00a0a9117e0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnRetriever.g.cs @@ -0,0 +1,480 @@ +// 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 Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless; + +public sealed partial class KnnRetriever +{ + /// + /// The name of the vector field to search against. + /// + [JsonInclude, JsonPropertyName("field")] + public string Field { get; set; } + + /// + /// Query to filter the documents that can match. + /// + [JsonInclude, JsonPropertyName("filter")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query))] + public ICollection? Filter { get; set; } + + /// + /// Number of nearest neighbors to return as top hits. + /// + [JsonInclude, JsonPropertyName("k")] + public int k { get; set; } + + /// + /// Number of nearest neighbor candidates to consider per shard. + /// + [JsonInclude, JsonPropertyName("num_candidates")] + public int NumCandidates { get; set; } + + /// + /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. + /// + [JsonInclude, JsonPropertyName("query_vector")] + public ICollection? QueryVector { get; set; } + + /// + /// Defines a model to build a query vector. + /// + [JsonInclude, JsonPropertyName("query_vector_builder")] + public Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? QueryVectorBuilder { get; set; } + + /// + /// The minimum similarity required for a document to be considered a match. + /// + [JsonInclude, JsonPropertyName("similarity")] + public float? Similarity { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Retriever(KnnRetriever knnRetriever) => Elastic.Clients.Elasticsearch.Serverless.Retriever.Knn(knnRetriever); +} + +public sealed partial class KnnRetrieverDescriptor : SerializableDescriptor> +{ + internal KnnRetrieverDescriptor(Action> configure) => configure.Invoke(this); + + public KnnRetrieverDescriptor() : base() + { + } + + private string FieldValue { get; set; } + private ICollection? FilterValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } + private Action> FilterDescriptorAction { get; set; } + private Action>[] FilterDescriptorActions { get; set; } + private int kValue { get; set; } + private int NumCandidatesValue { get; set; } + private ICollection? QueryVectorValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } + private Action QueryVectorBuilderDescriptorAction { get; set; } + private float? SimilarityValue { get; set; } + + /// + /// The name of the vector field to search against. + /// + public KnnRetrieverDescriptor Field(string field) + { + FieldValue = field; + return Self; + } + + /// + /// Query to filter the documents that can match. + /// + public KnnRetrieverDescriptor Filter(ICollection? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public KnnRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public KnnRetrieverDescriptor Filter(Action> configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public KnnRetrieverDescriptor Filter(params Action>[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + /// + /// Number of nearest neighbors to return as top hits. + /// + public KnnRetrieverDescriptor k(int k) + { + kValue = k; + return Self; + } + + /// + /// Number of nearest neighbor candidates to consider per shard. + /// + public KnnRetrieverDescriptor NumCandidates(int numCandidates) + { + NumCandidatesValue = numCandidates; + return Self; + } + + /// + /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. + /// + public KnnRetrieverDescriptor QueryVector(ICollection? queryVector) + { + QueryVectorValue = queryVector; + return Self; + } + + /// + /// Defines a model to build a query vector. + /// + public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? queryVectorBuilder) + { + QueryVectorBuilderDescriptor = null; + QueryVectorBuilderDescriptorAction = null; + QueryVectorBuilderValue = queryVectorBuilder; + return Self; + } + + public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor descriptor) + { + QueryVectorBuilderValue = null; + QueryVectorBuilderDescriptorAction = null; + QueryVectorBuilderDescriptor = descriptor; + return Self; + } + + public KnnRetrieverDescriptor QueryVectorBuilder(Action configure) + { + QueryVectorBuilderValue = null; + QueryVectorBuilderDescriptor = null; + QueryVectorBuilderDescriptorAction = configure; + return Self; + } + + /// + /// The minimum similarity required for a document to be considered a match. + /// + public KnnRetrieverDescriptor Similarity(float? similarity) + { + SimilarityValue = similarity; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("field"); + writer.WriteStringValue(FieldValue); + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + if (FilterDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(action), options); + } + + if (FilterDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); + } + + writer.WritePropertyName("k"); + writer.WriteNumberValue(kValue); + writer.WritePropertyName("num_candidates"); + writer.WriteNumberValue(NumCandidatesValue); + if (QueryVectorValue is not null) + { + writer.WritePropertyName("query_vector"); + JsonSerializer.Serialize(writer, QueryVectorValue, options); + } + + if (QueryVectorBuilderDescriptor is not null) + { + writer.WritePropertyName("query_vector_builder"); + JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); + } + else if (QueryVectorBuilderDescriptorAction is not null) + { + writer.WritePropertyName("query_vector_builder"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); + } + else if (QueryVectorBuilderValue is not null) + { + writer.WritePropertyName("query_vector_builder"); + JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); + } + + if (SimilarityValue.HasValue) + { + writer.WritePropertyName("similarity"); + writer.WriteNumberValue(SimilarityValue.Value); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class KnnRetrieverDescriptor : SerializableDescriptor +{ + internal KnnRetrieverDescriptor(Action configure) => configure.Invoke(this); + + public KnnRetrieverDescriptor() : base() + { + } + + private string FieldValue { get; set; } + private ICollection? FilterValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } + private Action FilterDescriptorAction { get; set; } + private Action[] FilterDescriptorActions { get; set; } + private int kValue { get; set; } + private int NumCandidatesValue { get; set; } + private ICollection? QueryVectorValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } + private Action QueryVectorBuilderDescriptorAction { get; set; } + private float? SimilarityValue { get; set; } + + /// + /// The name of the vector field to search against. + /// + public KnnRetrieverDescriptor Field(string field) + { + FieldValue = field; + return Self; + } + + /// + /// Query to filter the documents that can match. + /// + public KnnRetrieverDescriptor Filter(ICollection? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public KnnRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public KnnRetrieverDescriptor Filter(Action configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public KnnRetrieverDescriptor Filter(params Action[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + /// + /// Number of nearest neighbors to return as top hits. + /// + public KnnRetrieverDescriptor k(int k) + { + kValue = k; + return Self; + } + + /// + /// Number of nearest neighbor candidates to consider per shard. + /// + public KnnRetrieverDescriptor NumCandidates(int numCandidates) + { + NumCandidatesValue = numCandidates; + return Self; + } + + /// + /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both. + /// + public KnnRetrieverDescriptor QueryVector(ICollection? queryVector) + { + QueryVectorValue = queryVector; + return Self; + } + + /// + /// Defines a model to build a query vector. + /// + public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? queryVectorBuilder) + { + QueryVectorBuilderDescriptor = null; + QueryVectorBuilderDescriptorAction = null; + QueryVectorBuilderValue = queryVectorBuilder; + return Self; + } + + public KnnRetrieverDescriptor QueryVectorBuilder(Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor descriptor) + { + QueryVectorBuilderValue = null; + QueryVectorBuilderDescriptorAction = null; + QueryVectorBuilderDescriptor = descriptor; + return Self; + } + + public KnnRetrieverDescriptor QueryVectorBuilder(Action configure) + { + QueryVectorBuilderValue = null; + QueryVectorBuilderDescriptor = null; + QueryVectorBuilderDescriptorAction = configure; + return Self; + } + + /// + /// The minimum similarity required for a document to be considered a match. + /// + public KnnRetrieverDescriptor Similarity(float? similarity) + { + SimilarityValue = similarity; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("field"); + writer.WriteStringValue(FieldValue); + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + if (FilterDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(action), options); + } + + if (FilterDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); + } + + writer.WritePropertyName("k"); + writer.WriteNumberValue(kValue); + writer.WritePropertyName("num_candidates"); + writer.WriteNumberValue(NumCandidatesValue); + if (QueryVectorValue is not null) + { + writer.WritePropertyName("query_vector"); + JsonSerializer.Serialize(writer, QueryVectorValue, options); + } + + if (QueryVectorBuilderDescriptor is not null) + { + writer.WritePropertyName("query_vector_builder"); + JsonSerializer.Serialize(writer, QueryVectorBuilderDescriptor, options); + } + else if (QueryVectorBuilderDescriptorAction is not null) + { + writer.WritePropertyName("query_vector_builder"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor(QueryVectorBuilderDescriptorAction), options); + } + else if (QueryVectorBuilderValue is not null) + { + writer.WritePropertyName("query_vector_builder"); + JsonSerializer.Serialize(writer, QueryVectorBuilderValue, options); + } + + if (SimilarityValue.HasValue) + { + writer.WritePropertyName("similarity"); + writer.WriteNumberValue(SimilarityValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnSearch.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnSearch.g.cs index ba66c9ba49e..7b6f946c752 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/KnnSearch.g.cs @@ -58,13 +58,13 @@ public sealed partial class KnnSearch /// The final number of nearest neighbors to return as top hits /// [JsonInclude, JsonPropertyName("k")] - public long? k { get; set; } + public int? k { get; set; } /// /// The number of nearest neighbor candidates to consider per shard /// [JsonInclude, JsonPropertyName("num_candidates")] - public long? NumCandidates { get; set; } + public int? NumCandidates { get; set; } /// /// The query vector @@ -102,8 +102,8 @@ public KnnSearchDescriptor() : base() private Elastic.Clients.Elasticsearch.Serverless.Core.Search.InnerHits? InnerHitsValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } private Action> InnerHitsDescriptorAction { get; set; } - private long? kValue { get; set; } - private long? NumCandidatesValue { get; set; } + private int? kValue { get; set; } + private int? NumCandidatesValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } @@ -215,7 +215,7 @@ public KnnSearchDescriptor InnerHits(Action /// The final number of nearest neighbors to return as top hits /// - public KnnSearchDescriptor k(long? k) + public KnnSearchDescriptor k(int? k) { kValue = k; return Self; @@ -224,7 +224,7 @@ public KnnSearchDescriptor k(long? k) /// /// The number of nearest neighbor candidates to consider per shard /// - public KnnSearchDescriptor NumCandidates(long? numCandidates) + public KnnSearchDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; @@ -392,8 +392,8 @@ public KnnSearchDescriptor() : base() private Elastic.Clients.Elasticsearch.Serverless.Core.Search.InnerHits? InnerHitsValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } private Action InnerHitsDescriptorAction { get; set; } - private long? kValue { get; set; } - private long? NumCandidatesValue { get; set; } + private int? kValue { get; set; } + private int? NumCandidatesValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } @@ -505,7 +505,7 @@ public KnnSearchDescriptor InnerHits(Action /// The final number of nearest neighbors to return as top hits /// - public KnnSearchDescriptor k(long? k) + public KnnSearchDescriptor k(int? k) { kValue = k; return Self; @@ -514,7 +514,7 @@ public KnnSearchDescriptor k(long? k) /// /// The number of nearest neighbor candidates to consider per shard /// - public KnnSearchDescriptor NumCandidates(long? numCandidates) + public KnnSearchDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DenseVectorProperty.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DenseVectorProperty.g.cs index b2f5992601a..154282abce0 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DenseVectorProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DenseVectorProperty.g.cs @@ -33,6 +33,8 @@ public sealed partial class DenseVectorProperty : IProperty public int? Dims { get; set; } [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Serverless.Mapping.DynamicMapping? Dynamic { get; set; } + [JsonInclude, JsonPropertyName("element_type")] + public string? ElementType { get; set; } [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? Fields { get; set; } [JsonInclude, JsonPropertyName("ignore_above")] @@ -66,6 +68,7 @@ public DenseVectorPropertyDescriptor() : base() private int? DimsValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Mapping.DynamicMapping? DynamicValue { get; set; } + private string? ElementTypeValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? FieldsValue { get; set; } private int? IgnoreAboveValue { get; set; } private bool? IndexValue { get; set; } @@ -88,6 +91,12 @@ public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elastics return Self; } + public DenseVectorPropertyDescriptor ElementType(string? elementType) + { + ElementTypeValue = elementType; + return Self; + } + public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? fields) { FieldsValue = fields; @@ -194,6 +203,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, DynamicValue, options); } + if (!string.IsNullOrEmpty(ElementTypeValue)) + { + writer.WritePropertyName("element_type"); + writer.WriteStringValue(ElementTypeValue); + } + if (FieldsValue is not null) { writer.WritePropertyName("fields"); @@ -279,6 +294,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o { Dims = DimsValue, Dynamic = DynamicValue, + ElementType = ElementTypeValue, Fields = FieldsValue, IgnoreAbove = IgnoreAboveValue, Index = IndexValue, @@ -299,6 +315,7 @@ public DenseVectorPropertyDescriptor() : base() private int? DimsValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Mapping.DynamicMapping? DynamicValue { get; set; } + private string? ElementTypeValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? FieldsValue { get; set; } private int? IgnoreAboveValue { get; set; } private bool? IndexValue { get; set; } @@ -321,6 +338,12 @@ public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Serve return Self; } + public DenseVectorPropertyDescriptor ElementType(string? elementType) + { + ElementTypeValue = elementType; + return Self; + } + public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? fields) { FieldsValue = fields; @@ -427,6 +450,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, DynamicValue, options); } + if (!string.IsNullOrEmpty(ElementTypeValue)) + { + writer.WritePropertyName("element_type"); + writer.WriteStringValue(ElementTypeValue); + } + if (FieldsValue is not null) { writer.WritePropertyName("fields"); @@ -512,6 +541,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o { Dims = DimsValue, Dynamic = DynamicValue, + ElementType = ElementTypeValue, Fields = FieldsValue, IgnoreAbove = IgnoreAboveValue, Index = IndexValue, diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DynamicTemplate.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DynamicTemplate.g.cs index ca7ef1dc285..682aee0ba77 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DynamicTemplate.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/DynamicTemplate.g.cs @@ -21,28 +21,231 @@ using Elastic.Clients.Elasticsearch.Serverless.Serialization; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Serverless.Mapping; +[JsonConverter(typeof(DynamicTemplateConverter))] public sealed partial class DynamicTemplate { - [JsonInclude, JsonPropertyName("mapping")] - public Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty? Mapping { get; set; } + internal DynamicTemplate(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static DynamicTemplate Mapping(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty property) => new DynamicTemplate("mapping", property); + public static DynamicTemplate Runtime(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty property) => new DynamicTemplate("runtime", property); + [JsonInclude, JsonPropertyName("match")] - public string? Match { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? Match { get; set; } [JsonInclude, JsonPropertyName("match_mapping_type")] - public string? MatchMappingType { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? MatchMappingType { get; set; } [JsonInclude, JsonPropertyName("match_pattern")] public Elastic.Clients.Elasticsearch.Serverless.Mapping.MatchType? MatchPattern { get; set; } [JsonInclude, JsonPropertyName("path_match")] - public string? PathMatch { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? PathMatch { get; set; } [JsonInclude, JsonPropertyName("path_unmatch")] - public string? PathUnmatch { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? PathUnmatch { get; set; } [JsonInclude, JsonPropertyName("unmatch")] - public string? Unmatch { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? Unmatch { get; set; } + [JsonInclude, JsonPropertyName("unmatch_mapping_type")] + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? UnmatchMappingType { get; set; } + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class DynamicTemplateConverter : JsonConverter +{ + public override DynamicTemplate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + ICollection? matchValue = default; + ICollection? matchMappingTypeValue = default; + Elastic.Clients.Elasticsearch.Serverless.Mapping.MatchType? matchPatternValue = default; + ICollection? pathMatchValue = default; + ICollection? pathUnmatchValue = default; + ICollection? unmatchValue = default; + ICollection? unmatchMappingTypeValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "match") + { + matchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "match_mapping_type") + { + matchMappingTypeValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "match_pattern") + { + matchPatternValue = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (propertyName == "path_match") + { + pathMatchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "path_unmatch") + { + pathUnmatchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "unmatch") + { + unmatchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "unmatch_mapping_type") + { + unmatchMappingTypeValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "mapping") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "runtime") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DynamicTemplate' from the response."); + } + + var result = new DynamicTemplate(variantNameValue, variantValue); + result.Match = matchValue; + result.MatchMappingType = matchMappingTypeValue; + result.MatchPattern = matchPatternValue; + result.PathMatch = pathMatchValue; + result.PathUnmatch = pathUnmatchValue; + result.Unmatch = unmatchValue; + result.UnmatchMappingType = unmatchMappingTypeValue; + return result; + } + + public override void Write(Utf8JsonWriter writer, DynamicTemplate value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Match is not null) + { + writer.WritePropertyName("match"); + SingleOrManySerializationHelper.Serialize(value.Match, writer, options); + } + + if (value.MatchMappingType is not null) + { + writer.WritePropertyName("match_mapping_type"); + SingleOrManySerializationHelper.Serialize(value.MatchMappingType, writer, options); + } + + if (value.MatchPattern is not null) + { + writer.WritePropertyName("match_pattern"); + JsonSerializer.Serialize(writer, value.MatchPattern, options); + } + + if (value.PathMatch is not null) + { + writer.WritePropertyName("path_match"); + SingleOrManySerializationHelper.Serialize(value.PathMatch, writer, options); + } + + if (value.PathUnmatch is not null) + { + writer.WritePropertyName("path_unmatch"); + SingleOrManySerializationHelper.Serialize(value.PathUnmatch, writer, options); + } + + if (value.Unmatch is not null) + { + writer.WritePropertyName("unmatch"); + SingleOrManySerializationHelper.Serialize(value.Unmatch, writer, options); + } + + if (value.UnmatchMappingType is not null) + { + writer.WritePropertyName("unmatch_mapping_type"); + SingleOrManySerializationHelper.Serialize(value.UnmatchMappingType, writer, options); + } + + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "mapping": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty)value.Variant, options); + break; + case "runtime": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } } public sealed partial class DynamicTemplateDescriptor : SerializableDescriptor> @@ -53,27 +256,44 @@ public DynamicTemplateDescriptor() : base() { } - private Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty? MappingValue { get; set; } - private string? MatchValue { get; set; } - private string? MatchMappingTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Serverless.Mapping.MatchType? MatchPatternValue { get; set; } - private string? PathMatchValue { get; set; } - private string? PathUnmatchValue { get; set; } - private string? UnmatchValue { get; set; } + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } - public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty? mapping) + private DynamicTemplateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor { - MappingValue = mapping; + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; return Self; } - public DynamicTemplateDescriptor Match(string? match) + private DynamicTemplateDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + private ICollection? MatchValue { get; set; } + private ICollection? MatchMappingTypeValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Mapping.MatchType? MatchPatternValue { get; set; } + private ICollection? PathMatchValue { get; set; } + private ICollection? PathUnmatchValue { get; set; } + private ICollection? UnmatchValue { get; set; } + private ICollection? UnmatchMappingTypeValue { get; set; } + + public DynamicTemplateDescriptor Match(ICollection? match) { MatchValue = match; return Self; } - public DynamicTemplateDescriptor MatchMappingType(string? matchMappingType) + public DynamicTemplateDescriptor MatchMappingType(ICollection? matchMappingType) { MatchMappingTypeValue = matchMappingType; return Self; @@ -85,43 +305,46 @@ public DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elastic return Self; } - public DynamicTemplateDescriptor PathMatch(string? pathMatch) + public DynamicTemplateDescriptor PathMatch(ICollection? pathMatch) { PathMatchValue = pathMatch; return Self; } - public DynamicTemplateDescriptor PathUnmatch(string? pathUnmatch) + public DynamicTemplateDescriptor PathUnmatch(ICollection? pathUnmatch) { PathUnmatchValue = pathUnmatch; return Self; } - public DynamicTemplateDescriptor Unmatch(string? unmatch) + public DynamicTemplateDescriptor Unmatch(ICollection? unmatch) { UnmatchValue = unmatch; return Self; } + public DynamicTemplateDescriptor UnmatchMappingType(ICollection? unmatchMappingType) + { + UnmatchMappingTypeValue = unmatchMappingType; + return Self; + } + + public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty property) => Set(property, "mapping"); + public DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty property) => Set(property, "runtime"); + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - if (MappingValue is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingValue, options); - } - - if (!string.IsNullOrEmpty(MatchValue)) + if (MatchValue is not null) { writer.WritePropertyName("match"); - writer.WriteStringValue(MatchValue); + SingleOrManySerializationHelper.Serialize(MatchValue, writer, options); } - if (!string.IsNullOrEmpty(MatchMappingTypeValue)) + if (MatchMappingTypeValue is not null) { writer.WritePropertyName("match_mapping_type"); - writer.WriteStringValue(MatchMappingTypeValue); + SingleOrManySerializationHelper.Serialize(MatchMappingTypeValue, writer, options); } if (MatchPatternValue is not null) @@ -130,22 +353,41 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, MatchPatternValue, options); } - if (!string.IsNullOrEmpty(PathMatchValue)) + if (PathMatchValue is not null) { writer.WritePropertyName("path_match"); - writer.WriteStringValue(PathMatchValue); + SingleOrManySerializationHelper.Serialize(PathMatchValue, writer, options); } - if (!string.IsNullOrEmpty(PathUnmatchValue)) + if (PathUnmatchValue is not null) { writer.WritePropertyName("path_unmatch"); - writer.WriteStringValue(PathUnmatchValue); + SingleOrManySerializationHelper.Serialize(PathUnmatchValue, writer, options); } - if (!string.IsNullOrEmpty(UnmatchValue)) + if (UnmatchValue is not null) { writer.WritePropertyName("unmatch"); - writer.WriteStringValue(UnmatchValue); + SingleOrManySerializationHelper.Serialize(UnmatchValue, writer, options); + } + + if (UnmatchMappingTypeValue is not null) + { + writer.WritePropertyName("unmatch_mapping_type"); + SingleOrManySerializationHelper.Serialize(UnmatchMappingTypeValue, writer, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); } writer.WriteEndObject(); @@ -160,27 +402,44 @@ public DynamicTemplateDescriptor() : base() { } - private Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty? MappingValue { get; set; } - private string? MatchValue { get; set; } - private string? MatchMappingTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Serverless.Mapping.MatchType? MatchPatternValue { get; set; } - private string? PathMatchValue { get; set; } - private string? PathUnmatchValue { get; set; } - private string? UnmatchValue { get; set; } + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private DynamicTemplateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } - public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty? mapping) + private DynamicTemplateDescriptor Set(object variant, string variantName) { - MappingValue = mapping; + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; return Self; } - public DynamicTemplateDescriptor Match(string? match) + private ICollection? MatchValue { get; set; } + private ICollection? MatchMappingTypeValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Mapping.MatchType? MatchPatternValue { get; set; } + private ICollection? PathMatchValue { get; set; } + private ICollection? PathUnmatchValue { get; set; } + private ICollection? UnmatchValue { get; set; } + private ICollection? UnmatchMappingTypeValue { get; set; } + + public DynamicTemplateDescriptor Match(ICollection? match) { MatchValue = match; return Self; } - public DynamicTemplateDescriptor MatchMappingType(string? matchMappingType) + public DynamicTemplateDescriptor MatchMappingType(ICollection? matchMappingType) { MatchMappingTypeValue = matchMappingType; return Self; @@ -192,43 +451,46 @@ public DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elasticsearch.Serv return Self; } - public DynamicTemplateDescriptor PathMatch(string? pathMatch) + public DynamicTemplateDescriptor PathMatch(ICollection? pathMatch) { PathMatchValue = pathMatch; return Self; } - public DynamicTemplateDescriptor PathUnmatch(string? pathUnmatch) + public DynamicTemplateDescriptor PathUnmatch(ICollection? pathUnmatch) { PathUnmatchValue = pathUnmatch; return Self; } - public DynamicTemplateDescriptor Unmatch(string? unmatch) + public DynamicTemplateDescriptor Unmatch(ICollection? unmatch) { UnmatchValue = unmatch; return Self; } + public DynamicTemplateDescriptor UnmatchMappingType(ICollection? unmatchMappingType) + { + UnmatchMappingTypeValue = unmatchMappingType; + return Self; + } + + public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty property) => Set(property, "mapping"); + public DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Serverless.Mapping.IProperty property) => Set(property, "runtime"); + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - if (MappingValue is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingValue, options); - } - - if (!string.IsNullOrEmpty(MatchValue)) + if (MatchValue is not null) { writer.WritePropertyName("match"); - writer.WriteStringValue(MatchValue); + SingleOrManySerializationHelper.Serialize(MatchValue, writer, options); } - if (!string.IsNullOrEmpty(MatchMappingTypeValue)) + if (MatchMappingTypeValue is not null) { writer.WritePropertyName("match_mapping_type"); - writer.WriteStringValue(MatchMappingTypeValue); + SingleOrManySerializationHelper.Serialize(MatchMappingTypeValue, writer, options); } if (MatchPatternValue is not null) @@ -237,22 +499,41 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, MatchPatternValue, options); } - if (!string.IsNullOrEmpty(PathMatchValue)) + if (PathMatchValue is not null) { writer.WritePropertyName("path_match"); - writer.WriteStringValue(PathMatchValue); + SingleOrManySerializationHelper.Serialize(PathMatchValue, writer, options); } - if (!string.IsNullOrEmpty(PathUnmatchValue)) + if (PathUnmatchValue is not null) { writer.WritePropertyName("path_unmatch"); - writer.WriteStringValue(PathUnmatchValue); + SingleOrManySerializationHelper.Serialize(PathUnmatchValue, writer, options); } - if (!string.IsNullOrEmpty(UnmatchValue)) + if (UnmatchValue is not null) { writer.WritePropertyName("unmatch"); - writer.WriteStringValue(UnmatchValue); + SingleOrManySerializationHelper.Serialize(UnmatchValue, writer, options); + } + + if (UnmatchMappingTypeValue is not null) + { + writer.WritePropertyName("unmatch_mapping_type"); + SingleOrManySerializationHelper.Serialize(UnmatchMappingTypeValue, writer, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); } writer.WriteEndObject(); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/KeywordProperty.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/KeywordProperty.g.cs index 861cd3e4a79..5a4f3ac5a80 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/KeywordProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Mapping/KeywordProperty.g.cs @@ -60,8 +60,12 @@ public sealed partial class KeywordProperty : IProperty public bool? Norms { get; set; } [JsonInclude, JsonPropertyName("null_value")] public string? NullValue { get; set; } + [JsonInclude, JsonPropertyName("on_script_error")] + public Elastic.Clients.Elasticsearch.Serverless.Mapping.OnScriptError? OnScriptError { get; set; } [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? Properties { get; set; } + [JsonInclude, JsonPropertyName("script")] + public Elastic.Clients.Elasticsearch.Serverless.Script? Script { get; set; } [JsonInclude, JsonPropertyName("similarity")] public string? Similarity { get; set; } [JsonInclude, JsonPropertyName("split_queries_on_whitespace")] @@ -94,7 +98,9 @@ public KeywordPropertyDescriptor() : base() private string? NormalizerValue { get; set; } private bool? NormsValue { get; set; } private string? NullValueValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Mapping.OnScriptError? OnScriptErrorValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? PropertiesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Script? ScriptValue { get; set; } private string? SimilarityValue { get; set; } private bool? SplitQueriesOnWhitespaceValue { get; set; } private bool? StoreValue { get; set; } @@ -194,6 +200,12 @@ public KeywordPropertyDescriptor NullValue(string? nullValue) return Self; } + public KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Serverless.Mapping.OnScriptError? onScriptError) + { + OnScriptErrorValue = onScriptError; + return Self; + } + public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? properties) { PropertiesValue = properties; @@ -214,6 +226,12 @@ public KeywordPropertyDescriptor Properties(Action Script(Elastic.Clients.Elasticsearch.Serverless.Script? script) + { + ScriptValue = script; + return Self; + } + public KeywordPropertyDescriptor Similarity(string? similarity) { SimilarityValue = similarity; @@ -313,12 +331,24 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(NullValueValue); } + if (OnScriptErrorValue is not null) + { + writer.WritePropertyName("on_script_error"); + JsonSerializer.Serialize(writer, OnScriptErrorValue, options); + } + if (PropertiesValue is not null) { writer.WritePropertyName("properties"); JsonSerializer.Serialize(writer, PropertiesValue, options); } + if (ScriptValue is not null) + { + writer.WritePropertyName("script"); + JsonSerializer.Serialize(writer, ScriptValue, options); + } + if (!string.IsNullOrEmpty(SimilarityValue)) { writer.WritePropertyName("similarity"); @@ -357,7 +387,9 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o Normalizer = NormalizerValue, Norms = NormsValue, NullValue = NullValueValue, + OnScriptError = OnScriptErrorValue, Properties = PropertiesValue, + Script = ScriptValue, Similarity = SimilarityValue, SplitQueriesOnWhitespace = SplitQueriesOnWhitespaceValue, Store = StoreValue @@ -385,7 +417,9 @@ public KeywordPropertyDescriptor() : base() private string? NormalizerValue { get; set; } private bool? NormsValue { get; set; } private string? NullValueValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Mapping.OnScriptError? OnScriptErrorValue { get; set; } private Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? PropertiesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Script? ScriptValue { get; set; } private string? SimilarityValue { get; set; } private bool? SplitQueriesOnWhitespaceValue { get; set; } private bool? StoreValue { get; set; } @@ -485,6 +519,12 @@ public KeywordPropertyDescriptor NullValue(string? nullValue) return Self; } + public KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Serverless.Mapping.OnScriptError? onScriptError) + { + OnScriptErrorValue = onScriptError; + return Self; + } + public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Serverless.Mapping.Properties? properties) { PropertiesValue = properties; @@ -505,6 +545,12 @@ public KeywordPropertyDescriptor Properties(Action new Query("constant_score", constantScoreQuery); public static Query DisMax(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DisMaxQuery disMaxQuery) => new Query("dis_max", disMaxQuery); public static Query Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => new Query("exists", existsQuery); - public static Query FieldMaskingSpan(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new Query("field_masking_span", spanFieldMaskingQuery); public static Query FunctionScore(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.FunctionScoreQuery functionScoreQuery) => new Query("function_score", functionScoreQuery); public static Query Fuzzy(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.FuzzyQuery fuzzyQuery) => new Query("fuzzy", fuzzyQuery); public static Query GeoBoundingBox(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.GeoBoundingBoxQuery geoBoundingBoxQuery) => new Query("geo_bounding_box", geoBoundingBoxQuery); @@ -89,6 +88,7 @@ internal Query(string variantName, object variant) public static Query ScriptScore(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ScriptScoreQuery scriptScoreQuery) => new Query("script_score", scriptScoreQuery); public static Query SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new Query("simple_query_string", simpleQueryStringQuery); public static Query SpanContaining(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery spanContainingQuery) => new Query("span_containing", spanContainingQuery); + public static Query SpanFieldMasking(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new Query("span_field_masking", spanFieldMaskingQuery); public static Query SpanFirst(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery spanFirstQuery) => new Query("span_first", spanFirstQuery); public static Query SpanMulti(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => new Query("span_multi", spanMultiTermQuery); public static Query SpanNear(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanNearQuery spanNearQuery) => new Query("span_near", spanNearQuery); @@ -184,13 +184,6 @@ public override Query Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe continue; } - if (propertyName == "field_masking_span") - { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; - continue; - } - if (propertyName == "function_score") { variantValue = JsonSerializer.Deserialize(ref reader, options); @@ -422,6 +415,13 @@ public override Query Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe continue; } + if (propertyName == "span_field_masking") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + if (propertyName == "span_first") { variantValue = JsonSerializer.Deserialize(ref reader, options); @@ -553,9 +553,6 @@ public override void Write(Utf8JsonWriter writer, Query value, JsonSerializerOpt case "exists": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery)value.Variant, options); break; - case "field_masking_span": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); - break; case "function_score": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.FunctionScoreQuery)value.Variant, options); break; @@ -655,6 +652,9 @@ public override void Write(Utf8JsonWriter writer, Query value, JsonSerializerOpt case "span_containing": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery)value.Variant, options); break; + case "span_field_masking": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); + break; case "span_first": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery)value.Variant, options); break; @@ -747,8 +747,6 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor DisMax(Action> configure) => Set(configure, "dis_max"); public QueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); public QueryDescriptor Exists(Action> configure) => Set(configure, "exists"); - public QueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public QueryDescriptor FieldMaskingSpan(Action> configure) => Set(configure, "field_masking_span"); public QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.FunctionScoreQuery functionScoreQuery) => Set(functionScoreQuery, "function_score"); public QueryDescriptor FunctionScore(Action> configure) => Set(configure, "function_score"); public QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); @@ -813,6 +811,8 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); public QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public QueryDescriptor SpanContaining(Action> configure) => Set(configure, "span_containing"); + public QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public QueryDescriptor SpanFieldMasking(Action> configure) => Set(configure, "span_field_masking"); public QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public QueryDescriptor SpanFirst(Action> configure) => Set(configure, "span_first"); public QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); @@ -905,8 +905,6 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor DisMax(Action configure) => Set(configure, "dis_max"); public QueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); public QueryDescriptor Exists(Action configure) => Set(configure, "exists"); - public QueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public QueryDescriptor FieldMaskingSpan(Action configure) => Set(configure, "field_masking_span"); public QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.FunctionScoreQuery functionScoreQuery) => Set(functionScoreQuery, "function_score"); public QueryDescriptor FunctionScore(Action configure) => Set(configure, "function_score"); public QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); @@ -971,6 +969,8 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); public QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public QueryDescriptor SpanContaining(Action configure) => Set(configure, "span_containing"); + public QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public QueryDescriptor SpanFieldMasking(Action configure) => Set(configure, "span_field_masking"); public QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public QueryDescriptor SpanFirst(Action configure) => Set(configure, "span_first"); public QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs index 67c42cbda13..f42d166b8a3 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs @@ -41,8 +41,8 @@ public sealed partial class SpanFieldMaskingQuery [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } - public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.FieldMaskingSpan(spanFieldMaskingQuery); - public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanQuery(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanQuery.FieldMaskingSpan(spanFieldMaskingQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.SpanFieldMasking(spanFieldMaskingQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanQuery(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanQuery.SpanFieldMasking(spanFieldMaskingQuery); } public sealed partial class SpanFieldMaskingQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanQuery.g.cs index bb10051e17a..b12510520db 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SpanQuery.g.cs @@ -46,8 +46,8 @@ internal SpanQuery(string variantName, object variant) internal object Variant { get; } internal string VariantName { get; } - public static SpanQuery FieldMaskingSpan(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new SpanQuery("field_masking_span", spanFieldMaskingQuery); public static SpanQuery SpanContaining(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery spanContainingQuery) => new SpanQuery("span_containing", spanContainingQuery); + public static SpanQuery SpanFieldMasking(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new SpanQuery("span_field_masking", spanFieldMaskingQuery); public static SpanQuery SpanFirst(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery spanFirstQuery) => new SpanQuery("span_first", spanFirstQuery); public static SpanQuery SpanGap(KeyValuePair integer) => new SpanQuery("span_gap", integer); public static SpanQuery SpanMulti(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => new SpanQuery("span_multi", spanMultiTermQuery); @@ -95,16 +95,16 @@ public override SpanQuery Read(ref Utf8JsonReader reader, Type typeToConvert, Js var propertyName = reader.GetString(); reader.Read(); - if (propertyName == "field_masking_span") + if (propertyName == "span_containing") { - variantValue = JsonSerializer.Deserialize(ref reader, options); + variantValue = JsonSerializer.Deserialize(ref reader, options); variantNameValue = propertyName; continue; } - if (propertyName == "span_containing") + if (propertyName == "span_field_masking") { - variantValue = JsonSerializer.Deserialize(ref reader, options); + variantValue = JsonSerializer.Deserialize(ref reader, options); variantNameValue = propertyName; continue; } @@ -180,12 +180,12 @@ public override void Write(Utf8JsonWriter writer, SpanQuery value, JsonSerialize writer.WritePropertyName(value.VariantName); switch (value.VariantName) { - case "field_masking_span": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); - break; case "span_containing": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery)value.Variant, options); break; + case "span_field_masking": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); + break; case "span_first": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery)value.Variant, options); break; @@ -248,10 +248,10 @@ private SpanQueryDescriptor Set(object variant, string variantName) return Self; } - public SpanQueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public SpanQueryDescriptor FieldMaskingSpan(Action> configure) => Set(configure, "field_masking_span"); public SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public SpanQueryDescriptor SpanContaining(Action> configure) => Set(configure, "span_containing"); + public SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public SpanQueryDescriptor SpanFieldMasking(Action> configure) => Set(configure, "span_field_masking"); public SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public SpanQueryDescriptor SpanFirst(Action> configure) => Set(configure, "span_first"); public SpanQueryDescriptor SpanGap(KeyValuePair integer) => Set(integer, "span_gap"); @@ -319,10 +319,10 @@ private SpanQueryDescriptor Set(object variant, string variantName) return Self; } - public SpanQueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public SpanQueryDescriptor FieldMaskingSpan(Action configure) => Set(configure, "field_masking_span"); public SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public SpanQueryDescriptor SpanContaining(Action configure) => Set(configure, "span_containing"); + public SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public SpanQueryDescriptor SpanFieldMasking(Action configure) => Set(configure, "span_field_masking"); public SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public SpanQueryDescriptor SpanFirst(Action configure) => Set(configure, "span_first"); public SpanQueryDescriptor SpanGap(KeyValuePair integer) => Set(integer, "span_gap"); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/RRFRetriever.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/RRFRetriever.g.cs new file mode 100644 index 00000000000..769fe10fa08 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/RRFRetriever.g.cs @@ -0,0 +1,446 @@ +// 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 Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless; + +public sealed partial class RRFRetriever +{ + /// + /// Query to filter the documents that can match. + /// + [JsonInclude, JsonPropertyName("filter")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query))] + public ICollection? Filter { get; set; } + + /// + /// This value determines how much influence documents in individual result sets per query have over the final ranked result set. + /// + [JsonInclude, JsonPropertyName("rank_constant")] + public int? RankConstant { get; set; } + + /// + /// This value determines the size of the individual result sets per query. + /// + [JsonInclude, JsonPropertyName("rank_window_size")] + public int? RankWindowSize { get; set; } + + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + [JsonInclude, JsonPropertyName("retrievers")] + public ICollection Retrievers { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Retriever(RRFRetriever rRFRetriever) => Elastic.Clients.Elasticsearch.Serverless.Retriever.Rrf(rRFRetriever); +} + +public sealed partial class RRFRetrieverDescriptor : SerializableDescriptor> +{ + internal RRFRetrieverDescriptor(Action> configure) => configure.Invoke(this); + + public RRFRetrieverDescriptor() : base() + { + } + + private ICollection? FilterValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } + private Action> FilterDescriptorAction { get; set; } + private Action>[] FilterDescriptorActions { get; set; } + private int? RankConstantValue { get; set; } + private int? RankWindowSizeValue { get; set; } + private ICollection RetrieversValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor RetrieversDescriptor { get; set; } + private Action> RetrieversDescriptorAction { get; set; } + private Action>[] RetrieversDescriptorActions { get; set; } + + /// + /// Query to filter the documents that can match. + /// + public RRFRetrieverDescriptor Filter(ICollection? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public RRFRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public RRFRetrieverDescriptor Filter(Action> configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public RRFRetrieverDescriptor Filter(params Action>[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + /// + /// This value determines how much influence documents in individual result sets per query have over the final ranked result set. + /// + public RRFRetrieverDescriptor RankConstant(int? rankConstant) + { + RankConstantValue = rankConstant; + return Self; + } + + /// + /// This value determines the size of the individual result sets per query. + /// + public RRFRetrieverDescriptor RankWindowSize(int? rankWindowSize) + { + RankWindowSizeValue = rankWindowSize; + return Self; + } + + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + public RRFRetrieverDescriptor Retrievers(ICollection retrievers) + { + RetrieversDescriptor = null; + RetrieversDescriptorAction = null; + RetrieversDescriptorActions = null; + RetrieversValue = retrievers; + return Self; + } + + public RRFRetrieverDescriptor Retrievers(Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor descriptor) + { + RetrieversValue = null; + RetrieversDescriptorAction = null; + RetrieversDescriptorActions = null; + RetrieversDescriptor = descriptor; + return Self; + } + + public RRFRetrieverDescriptor Retrievers(Action> configure) + { + RetrieversValue = null; + RetrieversDescriptor = null; + RetrieversDescriptorActions = null; + RetrieversDescriptorAction = configure; + return Self; + } + + public RRFRetrieverDescriptor Retrievers(params Action>[] configure) + { + RetrieversValue = null; + RetrieversDescriptor = null; + RetrieversDescriptorAction = null; + RetrieversDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + if (FilterDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(action), options); + } + + if (FilterDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); + } + + if (RankConstantValue.HasValue) + { + writer.WritePropertyName("rank_constant"); + writer.WriteNumberValue(RankConstantValue.Value); + } + + if (RankWindowSizeValue.HasValue) + { + writer.WritePropertyName("rank_window_size"); + writer.WriteNumberValue(RankWindowSizeValue.Value); + } + + if (RetrieversDescriptor is not null) + { + writer.WritePropertyName("retrievers"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, RetrieversDescriptor, options); + writer.WriteEndArray(); + } + else if (RetrieversDescriptorAction is not null) + { + writer.WritePropertyName("retrievers"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor(RetrieversDescriptorAction), options); + writer.WriteEndArray(); + } + else if (RetrieversDescriptorActions is not null) + { + writer.WritePropertyName("retrievers"); + writer.WriteStartArray(); + foreach (var action in RetrieversDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else + { + writer.WritePropertyName("retrievers"); + JsonSerializer.Serialize(writer, RetrieversValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RRFRetrieverDescriptor : SerializableDescriptor +{ + internal RRFRetrieverDescriptor(Action configure) => configure.Invoke(this); + + public RRFRetrieverDescriptor() : base() + { + } + + private ICollection? FilterValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } + private Action FilterDescriptorAction { get; set; } + private Action[] FilterDescriptorActions { get; set; } + private int? RankConstantValue { get; set; } + private int? RankWindowSizeValue { get; set; } + private ICollection RetrieversValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor RetrieversDescriptor { get; set; } + private Action RetrieversDescriptorAction { get; set; } + private Action[] RetrieversDescriptorActions { get; set; } + + /// + /// Query to filter the documents that can match. + /// + public RRFRetrieverDescriptor Filter(ICollection? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public RRFRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public RRFRetrieverDescriptor Filter(Action configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public RRFRetrieverDescriptor Filter(params Action[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + /// + /// This value determines how much influence documents in individual result sets per query have over the final ranked result set. + /// + public RRFRetrieverDescriptor RankConstant(int? rankConstant) + { + RankConstantValue = rankConstant; + return Self; + } + + /// + /// This value determines the size of the individual result sets per query. + /// + public RRFRetrieverDescriptor RankWindowSize(int? rankWindowSize) + { + RankWindowSizeValue = rankWindowSize; + return Self; + } + + /// + /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. + /// + public RRFRetrieverDescriptor Retrievers(ICollection retrievers) + { + RetrieversDescriptor = null; + RetrieversDescriptorAction = null; + RetrieversDescriptorActions = null; + RetrieversValue = retrievers; + return Self; + } + + public RRFRetrieverDescriptor Retrievers(Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor descriptor) + { + RetrieversValue = null; + RetrieversDescriptorAction = null; + RetrieversDescriptorActions = null; + RetrieversDescriptor = descriptor; + return Self; + } + + public RRFRetrieverDescriptor Retrievers(Action configure) + { + RetrieversValue = null; + RetrieversDescriptor = null; + RetrieversDescriptorActions = null; + RetrieversDescriptorAction = configure; + return Self; + } + + public RRFRetrieverDescriptor Retrievers(params Action[] configure) + { + RetrieversValue = null; + RetrieversDescriptor = null; + RetrieversDescriptorAction = null; + RetrieversDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + if (FilterDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(action), options); + } + + if (FilterDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); + } + + if (RankConstantValue.HasValue) + { + writer.WritePropertyName("rank_constant"); + writer.WriteNumberValue(RankConstantValue.Value); + } + + if (RankWindowSizeValue.HasValue) + { + writer.WritePropertyName("rank_window_size"); + writer.WriteNumberValue(RankWindowSizeValue.Value); + } + + if (RetrieversDescriptor is not null) + { + writer.WritePropertyName("retrievers"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, RetrieversDescriptor, options); + writer.WriteEndArray(); + } + else if (RetrieversDescriptorAction is not null) + { + writer.WritePropertyName("retrievers"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor(RetrieversDescriptorAction), options); + writer.WriteEndArray(); + } + else if (RetrieversDescriptorActions is not null) + { + writer.WritePropertyName("retrievers"); + writer.WriteStartArray(); + foreach (var action in RetrieversDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.RetrieverDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else + { + writer.WritePropertyName("retrievers"); + JsonSerializer.Serialize(writer, RetrieversValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Retriever.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Retriever.g.cs new file mode 100644 index 00000000000..3c887d29e8e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Retriever.g.cs @@ -0,0 +1,257 @@ +// 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 Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless; + +[JsonConverter(typeof(RetrieverConverter))] +public sealed partial class Retriever +{ + internal Retriever(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static Retriever Knn(Elastic.Clients.Elasticsearch.Serverless.KnnRetriever knnRetriever) => new Retriever("knn", knnRetriever); + public static Retriever Rrf(Elastic.Clients.Elasticsearch.Serverless.RRFRetriever rRFRetriever) => new Retriever("rrf", rRFRetriever); + public static Retriever Standard(Elastic.Clients.Elasticsearch.Serverless.StandardRetriever standardRetriever) => new Retriever("standard", standardRetriever); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class RetrieverConverter : JsonConverter +{ + public override Retriever Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "knn") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "rrf") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "standard") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'Retriever' from the response."); + } + + var result = new Retriever(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, Retriever value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "knn": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.KnnRetriever)value.Variant, options); + break; + case "rrf": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.RRFRetriever)value.Variant, options); + break; + case "standard": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.StandardRetriever)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RetrieverDescriptor : SerializableDescriptor> +{ + internal RetrieverDescriptor(Action> configure) => configure.Invoke(this); + + public RetrieverDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RetrieverDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RetrieverDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RetrieverDescriptor Knn(Elastic.Clients.Elasticsearch.Serverless.KnnRetriever knnRetriever) => Set(knnRetriever, "knn"); + public RetrieverDescriptor Knn(Action> configure) => Set(configure, "knn"); + public RetrieverDescriptor Rrf(Elastic.Clients.Elasticsearch.Serverless.RRFRetriever rRFRetriever) => Set(rRFRetriever, "rrf"); + public RetrieverDescriptor Rrf(Action> configure) => Set(configure, "rrf"); + public RetrieverDescriptor Standard(Elastic.Clients.Elasticsearch.Serverless.StandardRetriever standardRetriever) => Set(standardRetriever, "standard"); + public RetrieverDescriptor Standard(Action> configure) => Set(configure, "standard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RetrieverDescriptor : SerializableDescriptor +{ + internal RetrieverDescriptor(Action configure) => configure.Invoke(this); + + public RetrieverDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RetrieverDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RetrieverDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RetrieverDescriptor Knn(Elastic.Clients.Elasticsearch.Serverless.KnnRetriever knnRetriever) => Set(knnRetriever, "knn"); + public RetrieverDescriptor Knn(Action configure) => Set(configure, "knn"); + public RetrieverDescriptor Rrf(Elastic.Clients.Elasticsearch.Serverless.RRFRetriever rRFRetriever) => Set(rRFRetriever, "rrf"); + public RetrieverDescriptor Rrf(Action configure) => Set(configure, "rrf"); + public RetrieverDescriptor Standard(Elastic.Clients.Elasticsearch.Serverless.StandardRetriever standardRetriever) => Set(standardRetriever, "standard"); + public RetrieverDescriptor Standard(Action configure) => Set(configure, "standard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/StandardRetriever.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/StandardRetriever.g.cs new file mode 100644 index 00000000000..b610f3d4b2f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/StandardRetriever.g.cs @@ -0,0 +1,677 @@ +// 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 Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless; + +public sealed partial class StandardRetriever +{ + /// + /// Collapses the top documents by a specified key into a single top document per key. + /// + [JsonInclude, JsonPropertyName("collapse")] + public Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapse? Collapse { get; set; } + + /// + /// Query to filter the documents that can match. + /// + [JsonInclude, JsonPropertyName("filter")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query))] + public ICollection? Filter { get; set; } + + /// + /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. + /// + [JsonInclude, JsonPropertyName("min_score")] + public float? MinScore { get; set; } + + /// + /// Defines a query to retrieve a set of top documents. + /// + [JsonInclude, JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query? Query { get; set; } + + /// + /// Defines a search after object parameter used for pagination. + /// + [JsonInclude, JsonPropertyName("search_after")] + public ICollection? SearchAfter { get; set; } + + /// + /// A sort object that that specifies the order of matching documents. + /// + [JsonInclude, JsonPropertyName("sort")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.SortOptions))] + public ICollection? Sort { get; set; } + + /// + /// Maximum number of documents to collect for each shard. + /// + [JsonInclude, JsonPropertyName("terminate_after")] + public int? TerminateAfter { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Retriever(StandardRetriever standardRetriever) => Elastic.Clients.Elasticsearch.Serverless.Retriever.Standard(standardRetriever); +} + +public sealed partial class StandardRetrieverDescriptor : SerializableDescriptor> +{ + internal StandardRetrieverDescriptor(Action> configure) => configure.Invoke(this); + + public StandardRetrieverDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapse? CollapseValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } + private Action> CollapseDescriptorAction { get; set; } + private ICollection? FilterValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } + private Action> FilterDescriptorAction { get; set; } + private Action>[] FilterDescriptorActions { get; set; } + private float? MinScoreValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } + private Action> QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action> SortDescriptorAction { get; set; } + private Action>[] SortDescriptorActions { get; set; } + private int? TerminateAfterValue { get; set; } + + /// + /// Collapses the top documents by a specified key into a single top document per key. + /// + public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapse? collapse) + { + CollapseDescriptor = null; + CollapseDescriptorAction = null; + CollapseValue = collapse; + return Self; + } + + public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapseDescriptor descriptor) + { + CollapseValue = null; + CollapseDescriptorAction = null; + CollapseDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Collapse(Action> configure) + { + CollapseValue = null; + CollapseDescriptor = null; + CollapseDescriptorAction = configure; + return Self; + } + + /// + /// Query to filter the documents that can match. + /// + public StandardRetrieverDescriptor Filter(ICollection? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public StandardRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Filter(Action> configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public StandardRetrieverDescriptor Filter(params Action>[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + /// + /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. + /// + public StandardRetrieverDescriptor MinScore(float? minScore) + { + MinScoreValue = minScore; + return Self; + } + + /// + /// Defines a query to retrieve a set of top documents. + /// + public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Query(Action> configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// Defines a search after object parameter used for pagination. + /// + public StandardRetrieverDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// A sort object that that specifies the order of matching documents. + /// + public StandardRetrieverDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public StandardRetrieverDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Sort(Action> configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public StandardRetrieverDescriptor Sort(params Action>[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + /// + /// Maximum number of documents to collect for each shard. + /// + public StandardRetrieverDescriptor TerminateAfter(int? terminateAfter) + { + TerminateAfterValue = terminateAfter; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (CollapseDescriptor is not null) + { + writer.WritePropertyName("collapse"); + JsonSerializer.Serialize(writer, CollapseDescriptor, options); + } + else if (CollapseDescriptorAction is not null) + { + writer.WritePropertyName("collapse"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); + } + else if (CollapseValue is not null) + { + writer.WritePropertyName("collapse"); + JsonSerializer.Serialize(writer, CollapseValue, options); + } + + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + if (FilterDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(action), options); + } + + if (FilterDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); + } + + if (MinScoreValue.HasValue) + { + writer.WritePropertyName("min_score"); + writer.WriteNumberValue(MinScoreValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + if (TerminateAfterValue.HasValue) + { + writer.WritePropertyName("terminate_after"); + writer.WriteNumberValue(TerminateAfterValue.Value); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class StandardRetrieverDescriptor : SerializableDescriptor +{ + internal StandardRetrieverDescriptor(Action configure) => configure.Invoke(this); + + public StandardRetrieverDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapse? CollapseValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapseDescriptor CollapseDescriptor { get; set; } + private Action CollapseDescriptorAction { get; set; } + private ICollection? FilterValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } + private Action FilterDescriptorAction { get; set; } + private Action[] FilterDescriptorActions { get; set; } + private float? MinScoreValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor QueryDescriptor { get; set; } + private Action QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action SortDescriptorAction { get; set; } + private Action[] SortDescriptorActions { get; set; } + private int? TerminateAfterValue { get; set; } + + /// + /// Collapses the top documents by a specified key into a single top document per key. + /// + public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapse? collapse) + { + CollapseDescriptor = null; + CollapseDescriptorAction = null; + CollapseValue = collapse; + return Self; + } + + public StandardRetrieverDescriptor Collapse(Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapseDescriptor descriptor) + { + CollapseValue = null; + CollapseDescriptorAction = null; + CollapseDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Collapse(Action configure) + { + CollapseValue = null; + CollapseDescriptor = null; + CollapseDescriptorAction = configure; + return Self; + } + + /// + /// Query to filter the documents that can match. + /// + public StandardRetrieverDescriptor Filter(ICollection? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public StandardRetrieverDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Filter(Action configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public StandardRetrieverDescriptor Filter(params Action[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + /// + /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. + /// + public StandardRetrieverDescriptor MinScore(float? minScore) + { + MinScoreValue = minScore; + return Self; + } + + /// + /// Defines a query to retrieve a set of top documents. + /// + public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public StandardRetrieverDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Query(Action configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// Defines a search after object parameter used for pagination. + /// + public StandardRetrieverDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// A sort object that that specifies the order of matching documents. + /// + public StandardRetrieverDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public StandardRetrieverDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public StandardRetrieverDescriptor Sort(Action configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public StandardRetrieverDescriptor Sort(params Action[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + /// + /// Maximum number of documents to collect for each shard. + /// + public StandardRetrieverDescriptor TerminateAfter(int? terminateAfter) + { + TerminateAfterValue = terminateAfter; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (CollapseDescriptor is not null) + { + writer.WritePropertyName("collapse"); + JsonSerializer.Serialize(writer, CollapseDescriptor, options); + } + else if (CollapseDescriptorAction is not null) + { + writer.WritePropertyName("collapse"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Core.Search.FieldCollapseDescriptor(CollapseDescriptorAction), options); + } + else if (CollapseValue is not null) + { + writer.WritePropertyName("collapse"); + JsonSerializer.Serialize(writer, CollapseValue, options); + } + + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(FilterDescriptorAction), options); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + if (FilterDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(action), options); + } + + if (FilterDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + SingleOrManySerializationHelper.Serialize(FilterValue, writer, options); + } + + if (MinScoreValue.HasValue) + { + writer.WritePropertyName("min_score"); + writer.WriteNumberValue(MinScoreValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.QueryDsl.QueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + if (TerminateAfterValue.HasValue) + { + writer.WritePropertyName("terminate_after"); + writer.WriteNumberValue(TerminateAfterValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs index 5241411bc42..87299ed9338 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs @@ -131,10 +131,10 @@ internal static class ApiUrlLookup internal static ApiUrls IndexManagementStats = new ApiUrls(new[] { "_stats", "_stats/{metric}", "{index}/_stats", "{index}/_stats/{metric}" }); internal static ApiUrls IndexManagementUpdateAliases = new ApiUrls(new[] { "_aliases" }); internal static ApiUrls IndexManagementValidateQuery = new ApiUrls(new[] { "_validate/query", "{index}/_validate/query" }); - internal static ApiUrls InferenceDeleteModel = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); - internal static ApiUrls InferenceGetModel = new ApiUrls(new[] { "_inference", "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); + internal static ApiUrls InferenceDelete = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); + internal static ApiUrls InferenceGet = new ApiUrls(new[] { "_inference", "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); internal static ApiUrls InferenceInference = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); - internal static ApiUrls InferencePutModel = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); + internal static ApiUrls InferencePut = new ApiUrls(new[] { "_inference/{inference_id}", "_inference/{task_type}/{inference_id}" }); internal static ApiUrls IngestDeletePipeline = new ApiUrls(new[] { "_ingest/pipeline/{id}" }); internal static ApiUrls IngestGeoIpStats = new ApiUrls(new[] { "_ingest/geoip/stats" }); internal static ApiUrls IngestGetPipeline = new ApiUrls(new[] { "_ingest/pipeline", "_ingest/pipeline/{id}" }); @@ -215,6 +215,7 @@ internal static class ApiUrlLookup internal static ApiUrls MachineLearningUpdateFilter = new ApiUrls(new[] { "_ml/filters/{filter_id}/_update" }); internal static ApiUrls MachineLearningUpdateJob = new ApiUrls(new[] { "_ml/anomaly_detectors/{job_id}/_update" }); internal static ApiUrls MachineLearningUpdateModelSnapshot = new ApiUrls(new[] { "_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update" }); + internal static ApiUrls MachineLearningUpdateTrainedModelDeployment = new ApiUrls(new[] { "_ml/trained_models/{model_id}/deployment/_update" }); internal static ApiUrls MachineLearningUpgradeJobSnapshot = new ApiUrls(new[] { "_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade" }); internal static ApiUrls MachineLearningValidate = new ApiUrls(new[] { "_ml/anomaly_detectors/_validate" }); internal static ApiUrls MachineLearningValidateDetector = new ApiUrls(new[] { "_ml/anomaly_detectors/_validate/detector" }); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs index d9343d50356..c364d920ddb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/PutComponentTemplateRequest.g.cs @@ -31,8 +31,6 @@ namespace Elastic.Clients.Elasticsearch.Cluster; public sealed partial class PutComponentTemplateRequestParameters : RequestParameters { - public string? Cause { get => Q("cause"); set => Q("cause", value); } - /// /// If `true`, this request cannot replace or update existing component templates. /// @@ -65,9 +63,6 @@ public PutComponentTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : ba internal override string OperationName => "cluster.put_component_template"; - [JsonIgnore] - public string? Cause { get => Q("cause"); set => Q("cause", value); } - /// /// If `true`, this request cannot replace or update existing component templates. /// @@ -128,7 +123,6 @@ public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name 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.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); @@ -263,7 +257,6 @@ public PutComponentTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Name 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.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs index 30aac9dbe87..edeaeb613d2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/CreateResponse.g.cs @@ -39,7 +39,7 @@ public sealed partial class CreateResponse : ElasticsearchResponse [JsonInclude, JsonPropertyName("result")] public Elastic.Clients.Elasticsearch.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.ShardStatistics Shards { get; init; } [JsonInclude, JsonPropertyName("_version")] diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs index 207f8a2c3cf..035076c71fd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/DeleteResponse.g.cs @@ -39,7 +39,7 @@ public sealed partial class DeleteResponse : ElasticsearchResponse [JsonInclude, JsonPropertyName("result")] public Elastic.Clients.Elasticsearch.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.ShardStatistics Shards { get; init; } [JsonInclude, JsonPropertyName("_version")] diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs index e6b6c6918a5..8f76d332896 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Esql/EsqlQueryRequest.g.cs @@ -92,12 +92,6 @@ public sealed partial class EsqlQueryRequest : PlainRequest [JsonInclude, JsonPropertyName("query")] public string Query { get; set; } - - /// - /// The version of the ES|QL language in which the "query" field was written. - /// - [JsonInclude, JsonPropertyName("version")] - public Elastic.Clients.Elasticsearch.Esql.Version Version { get; set; } } /// @@ -129,7 +123,6 @@ public EsqlQueryRequestDescriptor() private string? LocaleValue { get; set; } private ICollection? ParamsValue { get; set; } private string QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Esql.Version VersionValue { get; set; } /// /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. @@ -191,15 +184,6 @@ public EsqlQueryRequestDescriptor Query(string query) return Self; } - /// - /// The version of the ES|QL language in which the "query" field was written. - /// - public EsqlQueryRequestDescriptor Version(Elastic.Clients.Elasticsearch.Esql.Version version) - { - VersionValue = version; - return Self; - } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -239,8 +223,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WritePropertyName("query"); writer.WriteStringValue(QueryValue); - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, VersionValue, options); writer.WriteEndObject(); } } @@ -274,7 +256,6 @@ public EsqlQueryRequestDescriptor() private string? LocaleValue { get; set; } private ICollection? ParamsValue { get; set; } private string QueryValue { get; set; } - private Elastic.Clients.Elasticsearch.Esql.Version VersionValue { get; set; } /// /// By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. @@ -336,15 +317,6 @@ public EsqlQueryRequestDescriptor Query(string query) return Self; } - /// - /// The version of the ES|QL language in which the "query" field was written. - /// - public EsqlQueryRequestDescriptor Version(Elastic.Clients.Elasticsearch.Esql.Version version) - { - VersionValue = version; - return Self; - } - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -384,8 +356,6 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WritePropertyName("query"); writer.WriteStringValue(QueryValue); - writer.WritePropertyName("version"); - JsonSerializer.Serialize(writer, VersionValue, options); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs index 9760301010c..d3f545fc786 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/CreateIndexRequest.g.cs @@ -42,7 +42,7 @@ public sealed partial class CreateIndexRequestParameters : RequestParameters public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// - /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
+ /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
///
public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } } @@ -77,7 +77,7 @@ public CreateIndexRequest(Elastic.Clients.Elasticsearch.IndexName index) : base( public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// - /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
+ /// The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
///
[JsonIgnore] public Elastic.Clients.Elasticsearch.WaitForActiveShards? WaitForActiveShards { get => Q("wait_for_active_shards"); set => Q("wait_for_active_shards", value); } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs index 46f7ae261b1..5a806ae94a1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexManagement/PutTemplateRequest.g.cs @@ -106,7 +106,7 @@ public PutTemplateRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r /// Configuration options for the index. ///
[JsonInclude, JsonPropertyName("settings")] - public IDictionary? Settings { get; set; } + public Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? Settings { get; set; } /// /// Version number used to manage index templates externally. This number
is not automatically generated by Elasticsearch.
@@ -150,7 +150,9 @@ public PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearc private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } private Action> MappingsDescriptorAction { get; set; } private int? OrderValue { get; set; } - private IDictionary? SettingsValue { get; set; } + private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } + private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } + private Action> SettingsDescriptorAction { get; set; } private long? VersionValue { get; set; } /// @@ -211,9 +213,27 @@ public PutTemplateRequestDescriptor Order(int? order) /// /// Configuration options for the index. /// - public PutTemplateRequestDescriptor Settings(Func, FluentDictionary> selector) + public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) { - SettingsValue = selector?.Invoke(new FluentDictionary()); + SettingsDescriptor = null; + SettingsDescriptorAction = null; + SettingsValue = settings; + return Self; + } + + public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + { + SettingsValue = null; + SettingsDescriptorAction = null; + SettingsDescriptor = descriptor; + return Self; + } + + public PutTemplateRequestDescriptor Settings(Action> configure) + { + SettingsValue = null; + SettingsDescriptor = null; + SettingsDescriptorAction = configure; return Self; } @@ -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.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); + } + else if (SettingsValue is not null) { writer.WritePropertyName("settings"); JsonSerializer.Serialize(writer, SettingsValue, options); @@ -314,7 +344,9 @@ public PutTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name private Elastic.Clients.Elasticsearch.Mapping.TypeMappingDescriptor MappingsDescriptor { get; set; } private Action MappingsDescriptorAction { get; set; } private int? OrderValue { get; set; } - private IDictionary? SettingsValue { get; set; } + private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? SettingsValue { get; set; } + private Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor SettingsDescriptor { get; set; } + private Action SettingsDescriptorAction { get; set; } private long? VersionValue { get; set; } /// @@ -375,9 +407,27 @@ public PutTemplateRequestDescriptor Order(int? order) /// /// Configuration options for the index. /// - public PutTemplateRequestDescriptor Settings(Func, FluentDictionary> selector) + public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings? settings) { - SettingsValue = selector?.Invoke(new FluentDictionary()); + SettingsDescriptor = null; + SettingsDescriptorAction = null; + SettingsValue = settings; + return Self; + } + + public PutTemplateRequestDescriptor Settings(Elastic.Clients.Elasticsearch.IndexManagement.IndexSettingsDescriptor descriptor) + { + SettingsValue = null; + SettingsDescriptorAction = null; + SettingsDescriptor = descriptor; + return Self; + } + + public PutTemplateRequestDescriptor Settings(Action configure) + { + SettingsValue = null; + SettingsDescriptor = null; + SettingsDescriptorAction = configure; return Self; } @@ -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.IndexManagement.IndexSettingsDescriptor(SettingsDescriptorAction), options); + } + else if (SettingsValue is not null) { writer.WritePropertyName("settings"); JsonSerializer.Serialize(writer, SettingsValue, options); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs index 584b114c018..289d66cf21d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/IndexResponse.g.cs @@ -39,7 +39,7 @@ public sealed partial class IndexResponse : ElasticsearchResponse [JsonInclude, JsonPropertyName("result")] public Elastic.Clients.Elasticsearch.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.ShardStatistics Shards { get; init; } [JsonInclude, JsonPropertyName("_version")] diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteModelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs similarity index 58% rename from src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteModelRequest.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs index 32776650fb1..ad0207b2280 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteModelRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceRequest.g.cs @@ -29,62 +29,62 @@ namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class DeleteModelRequestParameters : RequestParameters +public sealed partial class DeleteInferenceRequestParameters : RequestParameters { } /// -/// Delete an inference service model +/// Delete an inference endpoint /// -public sealed partial class DeleteModelRequest : PlainRequest +public sealed partial class DeleteInferenceRequest : PlainRequest { - public DeleteModelRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + public DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) { } - public DeleteModelRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) + public DeleteInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceDeleteModel; + internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceDelete; protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; internal override bool SupportsBody => false; - internal override string OperationName => "inference.delete_model"; + internal override string OperationName => "inference.delete"; } /// -/// Delete an inference service model +/// Delete an inference endpoint /// -public sealed partial class DeleteModelRequestDescriptor : RequestDescriptor +public sealed partial class DeleteInferenceRequestDescriptor : RequestDescriptor { - internal DeleteModelRequestDescriptor(Action configure) => configure.Invoke(this); + internal DeleteInferenceRequestDescriptor(Action configure) => configure.Invoke(this); - public DeleteModelRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) + public DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) { } - public DeleteModelRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + public DeleteInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceDeleteModel; + internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceDelete; protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; internal override bool SupportsBody => false; - internal override string OperationName => "inference.delete_model"; + internal override string OperationName => "inference.delete"; - public DeleteModelRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) + public DeleteInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) { RouteValues.Required("inference_id", inferenceId); return Self; } - public DeleteModelRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) + public DeleteInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) { RouteValues.Optional("task_type", taskType); return Self; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteModelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceResponse.g.cs similarity index 95% rename from src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteModelResponse.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceResponse.g.cs index 2cec0ca460c..92fff276e64 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteModelResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/DeleteInferenceResponse.g.cs @@ -26,7 +26,7 @@ namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class DeleteModelResponse : ElasticsearchResponse +public sealed partial class DeleteInferenceResponse : ElasticsearchResponse { /// /// For a successful response, this value is always true. On failure, an exception is returned instead. diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetModelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceRequest.g.cs similarity index 57% rename from src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetModelRequest.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceRequest.g.cs index e0b4750a610..21c2cfb89b8 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetModelRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceRequest.g.cs @@ -29,66 +29,66 @@ namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class GetModelRequestParameters : RequestParameters +public sealed partial class GetInferenceRequestParameters : RequestParameters { } /// -/// Get an inference service model +/// Get an inference endpoint /// -public sealed partial class GetModelRequest : PlainRequest +public sealed partial class GetInferenceRequest : PlainRequest { - public GetModelRequest() + public GetInferenceRequest() { } - public GetModelRequest(Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("inference_id", inferenceId)) + public GetInferenceRequest(Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("inference_id", inferenceId)) { } - public GetModelRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("task_type", taskType).Optional("inference_id", inferenceId)) + public GetInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("task_type", taskType).Optional("inference_id", inferenceId)) { } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceGetModel; + internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceGet; protected override HttpMethod StaticHttpMethod => HttpMethod.GET; internal override bool SupportsBody => false; - internal override string OperationName => "inference.get_model"; + internal override string OperationName => "inference.get"; } /// -/// Get an inference service model +/// Get an inference endpoint /// -public sealed partial class GetModelRequestDescriptor : RequestDescriptor +public sealed partial class GetInferenceRequestDescriptor : RequestDescriptor { - internal GetModelRequestDescriptor(Action configure) => configure.Invoke(this); + internal GetInferenceRequestDescriptor(Action configure) => configure.Invoke(this); - public GetModelRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("task_type", taskType).Optional("inference_id", inferenceId)) + public GetInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) : base(r => r.Optional("task_type", taskType).Optional("inference_id", inferenceId)) { } - public GetModelRequestDescriptor() + public GetInferenceRequestDescriptor() { } - internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceGetModel; + internal override ApiUrls ApiUrls => ApiUrlLookup.InferenceGet; protected override HttpMethod StaticHttpMethod => HttpMethod.GET; internal override bool SupportsBody => false; - internal override string OperationName => "inference.get_model"; + internal override string OperationName => "inference.get"; - public GetModelRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? inferenceId) + public GetInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id? inferenceId) { RouteValues.Optional("inference_id", inferenceId); return Self; } - public GetModelRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) + public GetInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) { RouteValues.Optional("task_type", taskType); return Self; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetModelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceResponse.g.cs similarity index 89% rename from src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetModelResponse.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceResponse.g.cs index d808e8a8e83..254b29ef133 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetModelResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/GetInferenceResponse.g.cs @@ -26,8 +26,8 @@ namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class GetModelResponse : ElasticsearchResponse +public sealed partial class GetInferenceResponse : ElasticsearchResponse { - [JsonInclude, JsonPropertyName("models")] - public IReadOnlyCollection Models { get; init; } + [JsonInclude, JsonPropertyName("endpoints")] + public IReadOnlyCollection Endpoints { get; init; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceRequest.g.cs index a46ff47b556..8c5c67af808 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/InferenceRequest.g.cs @@ -65,7 +65,7 @@ public InferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskTy public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } /// - /// Text input to the model.
Either a string or an array of strings.
+ /// Inference input.
Either a string or an array of strings.
///
[JsonInclude, JsonPropertyName("input")] [SingleOrManyCollectionConverter(typeof(string))] @@ -126,7 +126,7 @@ public InferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inferen private object? TaskSettingsValue { get; set; } /// - /// Text input to the model.
Either a string or an array of strings.
+ /// Inference input.
Either a string or an array of strings.
///
public InferenceRequestDescriptor Input(ICollection input) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs new file mode 100644 index 00000000000..e69e17d4cbe --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceRequest.g.cs @@ -0,0 +1,127 @@ +// 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 Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Inference; + +public sealed partial class PutInferenceRequestParameters : RequestParameters +{ +} + +/// +/// Create an inference endpoint +/// +public sealed partial class PutInferenceRequest : PlainRequest, ISelfSerializable +{ + public PutInferenceRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) + { + } + + public PutInferenceRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.InferencePut; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put"; + + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfig { get; set; } + + void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + JsonSerializer.Serialize(writer, InferenceConfig, options); + } +} + +/// +/// Create an inference endpoint +/// +public sealed partial class PutInferenceRequestDescriptor : RequestDescriptor +{ + internal PutInferenceRequestDescriptor(Action configure) => configure.Invoke(this); + public PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) => InferenceConfigValue = inferenceConfig; + public PutInferenceRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) => InferenceConfigValue = inferenceConfig; + + internal override ApiUrls ApiUrls => ApiUrlLookup.InferencePut; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "inference.put"; + + public PutInferenceRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) + { + RouteValues.Required("inference_id", inferenceId); + return Self; + } + + public PutInferenceRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) + { + RouteValues.Optional("task_type", taskType); + return Self; + } + + private Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint InferenceConfigValue { get; set; } + private Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor InferenceConfigDescriptor { get; set; } + private Action InferenceConfigDescriptorAction { get; set; } + + public PutInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig) + { + InferenceConfigDescriptor = null; + InferenceConfigDescriptorAction = null; + InferenceConfigValue = inferenceConfig; + return Self; + } + + public PutInferenceRequestDescriptor InferenceConfig(Elastic.Clients.Elasticsearch.Inference.InferenceEndpointDescriptor descriptor) + { + InferenceConfigValue = null; + InferenceConfigDescriptorAction = null; + InferenceConfigDescriptor = descriptor; + return Self; + } + + public PutInferenceRequestDescriptor InferenceConfig(Action configure) + { + InferenceConfigValue = null; + InferenceConfigDescriptor = null; + InferenceConfigDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + JsonSerializer.Serialize(writer, InferenceConfigValue, options); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutModelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceResponse.g.cs similarity index 87% rename from src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutModelResponse.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceResponse.g.cs index 68c96463b2b..dc6a5867f96 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutModelResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutInferenceResponse.g.cs @@ -26,13 +26,13 @@ namespace Elastic.Clients.Elasticsearch.Inference; -public sealed partial class PutModelResponse : ElasticsearchResponse +public sealed partial class PutInferenceResponse : ElasticsearchResponse { /// - /// The model Id + /// The inference Id /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; init; } + [JsonInclude, JsonPropertyName("inference_id")] + public string InferenceId { get; init; } /// /// The service type @@ -47,13 +47,13 @@ public sealed partial class PutModelResponse : ElasticsearchResponse public object ServiceSettings { get; init; } /// - /// Task settings specific to the service and model + /// Task settings specific to the service and task type /// [JsonInclude, JsonPropertyName("task_settings")] public object TaskSettings { get; init; } /// - /// The model's task type + /// The task type /// [JsonInclude, JsonPropertyName("task_type")] public Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; init; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutModelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutModelRequest.g.cs deleted file mode 100644 index 857ed069b7f..00000000000 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Inference/PutModelRequest.g.cs +++ /dev/null @@ -1,127 +0,0 @@ -// 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 Elastic.Clients.Elasticsearch.Fluent; -using Elastic.Clients.Elasticsearch.Requests; -using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Elastic.Clients.Elasticsearch.Inference; - -public sealed partial class PutModelRequestParameters : RequestParameters -{ -} - -/// -/// Create an inference service model -/// -public sealed partial class PutModelRequest : PlainRequest, ISelfSerializable -{ - public PutModelRequest(Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) - { - } - - public PutModelRequest(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) - { - } - - internal override ApiUrls ApiUrls => ApiUrlLookup.InferencePutModel; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "inference.put_model"; - - [JsonIgnore] - public Elastic.Clients.Elasticsearch.Inference.ModelConfig ModelConfig { get; set; } - - void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, ModelConfig, options); - } -} - -/// -/// Create an inference service model -/// -public sealed partial class PutModelRequestDescriptor : RequestDescriptor -{ - internal PutModelRequestDescriptor(Action configure) => configure.Invoke(this); - public PutModelRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Optional("task_type", taskType).Required("inference_id", inferenceId)) => ModelConfigValue = modelConfig; - public PutModelRequestDescriptor(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Id inferenceId) : base(r => r.Required("inference_id", inferenceId)) => ModelConfigValue = modelConfig; - - internal override ApiUrls ApiUrls => ApiUrlLookup.InferencePutModel; - - protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; - - internal override bool SupportsBody => true; - - internal override string OperationName => "inference.put_model"; - - public PutModelRequestDescriptor InferenceId(Elastic.Clients.Elasticsearch.Id inferenceId) - { - RouteValues.Required("inference_id", inferenceId); - return Self; - } - - public PutModelRequestDescriptor TaskType(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType) - { - RouteValues.Optional("task_type", taskType); - return Self; - } - - private Elastic.Clients.Elasticsearch.Inference.ModelConfig ModelConfigValue { get; set; } - private Elastic.Clients.Elasticsearch.Inference.ModelConfigDescriptor ModelConfigDescriptor { get; set; } - private Action ModelConfigDescriptorAction { get; set; } - - public PutModelRequestDescriptor ModelConfig(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig) - { - ModelConfigDescriptor = null; - ModelConfigDescriptorAction = null; - ModelConfigValue = modelConfig; - return Self; - } - - public PutModelRequestDescriptor ModelConfig(Elastic.Clients.Elasticsearch.Inference.ModelConfigDescriptor descriptor) - { - ModelConfigValue = null; - ModelConfigDescriptorAction = null; - ModelConfigDescriptor = descriptor; - return Self; - } - - public PutModelRequestDescriptor ModelConfig(Action configure) - { - ModelConfigValue = null; - ModelConfigDescriptor = null; - ModelConfigDescriptorAction = configure; - return Self; - } - - protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) - { - JsonSerializer.Serialize(writer, ModelConfigValue, options); - } -} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs new file mode 100644 index 00000000000..e2555c4430f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentRequest.g.cs @@ -0,0 +1,107 @@ +// 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 Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.MachineLearning; + +public sealed partial class UpdateTrainedModelDeploymentRequestParameters : RequestParameters +{ +} + +/// +/// Starts a trained model deployment, which allocates the model to every machine learning node. +/// +public sealed partial class UpdateTrainedModelDeploymentRequest : PlainRequest +{ + public UpdateTrainedModelDeploymentRequest(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateTrainedModelDeployment; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "ml.update_trained_model_deployment"; + + /// + /// The number of model allocations on each node where the model is deployed.
All allocations on a node share the same copy of the model in memory but use
a separate set of threads to evaluate the model.
Increasing this value generally increases the throughput.
If this setting is greater than the number of hardware threads
it will automatically be changed to a value less than the number of hardware threads.
+ ///
+ [JsonInclude, JsonPropertyName("number_of_allocations")] + public int? NumberOfAllocations { get; set; } +} + +/// +/// Starts a trained model deployment, which allocates the model to every machine learning node. +/// +public sealed partial class UpdateTrainedModelDeploymentRequestDescriptor : RequestDescriptor +{ + internal UpdateTrainedModelDeploymentRequestDescriptor(Action configure) => configure.Invoke(this); + + public UpdateTrainedModelDeploymentRequestDescriptor(Elastic.Clients.Elasticsearch.Id modelId) : base(r => r.Required("model_id", modelId)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpdateTrainedModelDeployment; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "ml.update_trained_model_deployment"; + + public UpdateTrainedModelDeploymentRequestDescriptor ModelId(Elastic.Clients.Elasticsearch.Id modelId) + { + RouteValues.Required("model_id", modelId); + return Self; + } + + private int? NumberOfAllocationsValue { get; set; } + + /// + /// The number of model allocations on each node where the model is deployed.
All allocations on a node share the same copy of the model in memory but use
a separate set of threads to evaluate the model.
Increasing this value generally increases the throughput.
If this setting is greater than the number of hardware threads
it will automatically be changed to a value less than the number of hardware threads.
+ ///
+ public UpdateTrainedModelDeploymentRequestDescriptor NumberOfAllocations(int? numberOfAllocations) + { + NumberOfAllocationsValue = numberOfAllocations; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (NumberOfAllocationsValue.HasValue) + { + writer.WritePropertyName("number_of_allocations"); + writer.WriteNumberValue(NumberOfAllocationsValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Esql.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs similarity index 56% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Esql.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs index ad611e00f12..3ef93e48077 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Esql.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/MachineLearning/UpdateTrainedModelDeploymentResponse.g.cs @@ -17,51 +17,17 @@ #nullable restore -using Elastic.Clients.Elasticsearch.Core; +using Elastic.Clients.Elasticsearch.Fluent; using Elastic.Clients.Elasticsearch.Serialization; -using Elastic.Transport; +using Elastic.Transport.Products.Elasticsearch; using System; -using System.Runtime.Serialization; -using System.Text; -using System.Text.Json; +using System.Collections.Generic; using System.Text.Json.Serialization; -namespace Elastic.Clients.Elasticsearch.Esql; +namespace Elastic.Clients.Elasticsearch.MachineLearning; -[JsonConverter(typeof(VersionConverter))] -public enum Version +public sealed partial class UpdateTrainedModelDeploymentResponse : ElasticsearchResponse { - /// - /// Run against the first version of ES|QL. - /// - [EnumMember(Value = "2024.04.01")] - V20240401 -} - -internal sealed class VersionConverter : JsonConverter -{ - public override Version Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var enumString = reader.GetString(); - switch (enumString) - { - case "2024.04.01": - return Version.V20240401; - } - - ThrowHelper.ThrowJsonException(); - return default; - } - - public override void Write(Utf8JsonWriter writer, Version value, JsonSerializerOptions options) - { - switch (value) - { - case Version.V20240401: - writer.WriteStringValue("2024.04.01"); - return; - } - - writer.WriteNullValue(); - } + [JsonInclude, JsonPropertyName("assignment")] + public Elastic.Clients.Elasticsearch.MachineLearning.TrainedModelAssignment Assignment { get; init; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs index 8c513aa7074..21b5b6c1093 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Synonyms/PutSynonymResponse.g.cs @@ -29,7 +29,7 @@ namespace Elastic.Clients.Elasticsearch.Synonyms; public sealed partial class PutSynonymResponse : ElasticsearchResponse { [JsonInclude, JsonPropertyName("reload_analyzers_details")] - public Elastic.Clients.Elasticsearch.IndexManagement.ReloadDetails ReloadAnalyzersDetails { get; init; } + public Elastic.Clients.Elasticsearch.IndexManagement.ReloadResult ReloadAnalyzersDetails { get; init; } [JsonInclude, JsonPropertyName("result")] public Elastic.Clients.Elasticsearch.Result Result { get; init; } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs index 58d6182e154..fb1f7195afe 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/UpdateResponse.g.cs @@ -41,7 +41,7 @@ public sealed partial class UpdateResponse : ElasticsearchResponse [JsonInclude, JsonPropertyName("result")] public Elastic.Clients.Elasticsearch.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.ShardStatistics Shards { get; init; } [JsonInclude, JsonPropertyName("_version")] diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs index 2778a38abe1..654b6ccc271 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Inference.g.cs @@ -38,283 +38,283 @@ internal InferenceNamespacedClient(ElasticsearchClient client) : base(client) } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelResponse DeleteModel(DeleteModelRequest request) + public virtual DeleteInferenceResponse Delete(DeleteInferenceRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task DeleteModelAsync(DeleteModelRequest request, CancellationToken cancellationToken = default) + public virtual Task DeleteAsync(DeleteInferenceRequest request, CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelResponse DeleteModel(DeleteModelRequestDescriptor descriptor) + public virtual DeleteInferenceResponse Delete(DeleteInferenceRequestDescriptor descriptor) { descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelResponse DeleteModel(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new DeleteModelRequestDescriptor(taskType, inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelResponse DeleteModel(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) { - var descriptor = new DeleteModelRequestDescriptor(taskType, inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelResponse DeleteModel(Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new DeleteModelRequestDescriptor(inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual DeleteModelResponse DeleteModel(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual DeleteInferenceResponse Delete(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) { - var descriptor = new DeleteModelRequestDescriptor(inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task DeleteModelAsync(DeleteModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Task DeleteAsync(DeleteInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) { descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task DeleteModelAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) { - var descriptor = new DeleteModelRequestDescriptor(taskType, inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task DeleteModelAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) { - var descriptor = new DeleteModelRequestDescriptor(taskType, inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(taskType, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task DeleteModelAsync(Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) { - var descriptor = new DeleteModelRequestDescriptor(inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Delete model in the Inference API + /// Delete an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task DeleteModelAsync(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Task DeleteAsync(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) { - var descriptor = new DeleteModelRequestDescriptor(inferenceId); + var descriptor = new DeleteInferenceRequestDescriptor(inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelResponse GetModel(GetModelRequest request) + public virtual GetInferenceResponse Get(GetInferenceRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task GetModelAsync(GetModelRequest request, CancellationToken cancellationToken = default) + public virtual Task GetAsync(GetInferenceRequest request, CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelResponse GetModel(GetModelRequestDescriptor descriptor) + public virtual GetInferenceResponse Get(GetInferenceRequestDescriptor descriptor) { descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelResponse GetModel(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) + public virtual GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId) { - var descriptor = new GetModelRequestDescriptor(taskType, inferenceId); + var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelResponse GetModel(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, Action configureRequest) + public virtual GetInferenceResponse Get(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, Action configureRequest) { - var descriptor = new GetModelRequestDescriptor(taskType, inferenceId); + var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelResponse GetModel() + public virtual GetInferenceResponse Get() { - var descriptor = new GetModelRequestDescriptor(); + var descriptor = new GetInferenceRequestDescriptor(); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual GetModelResponse GetModel(Action configureRequest) + public virtual GetInferenceResponse Get(Action configureRequest) { - var descriptor = new GetModelRequestDescriptor(); + var descriptor = new GetInferenceRequestDescriptor(); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task GetModelAsync(GetModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Task GetAsync(GetInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) { descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task GetModelAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, CancellationToken cancellationToken = default) + public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, CancellationToken cancellationToken = default) { - var descriptor = new GetModelRequestDescriptor(taskType, inferenceId); + var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task GetModelAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id? inferenceId, Action configureRequest, CancellationToken cancellationToken = default) { - var descriptor = new GetModelRequestDescriptor(taskType, inferenceId); + var descriptor = new GetInferenceRequestDescriptor(taskType, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task GetModelAsync(CancellationToken cancellationToken = default) + public virtual Task GetAsync(CancellationToken cancellationToken = default) { - var descriptor = new GetModelRequestDescriptor(); + var descriptor = new GetInferenceRequestDescriptor(); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Get a model in the Inference API + /// Get an inference endpoint /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task GetModelAsync(Action configureRequest, CancellationToken cancellationToken = default) + public virtual Task GetAsync(Action configureRequest, CancellationToken cancellationToken = default) { - var descriptor = new GetModelRequestDescriptor(); + var descriptor = new GetInferenceRequestDescriptor(); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] @@ -325,7 +325,7 @@ public virtual InferenceResponse Inference(InferenceRequest request) } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task InferenceAsync(InferenceRequest request, CancellationToken cancellationToken = default) @@ -335,7 +335,7 @@ public virtual Task InferenceAsync(InferenceRequest request, } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] @@ -346,7 +346,7 @@ public virtual InferenceResponse Inference(InferenceRequestDescriptor descriptor } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] @@ -358,7 +358,7 @@ public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Inferen } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] @@ -371,7 +371,7 @@ public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Inferen } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] @@ -383,7 +383,7 @@ public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Id infe } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] @@ -396,7 +396,7 @@ public virtual InferenceResponse Inference(Elastic.Clients.Elasticsearch.Id infe } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task InferenceAsync(InferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) @@ -406,7 +406,7 @@ public virtual Task InferenceAsync(InferenceRequestDescriptor } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) @@ -417,7 +417,7 @@ public virtual Task InferenceAsync(Elastic.Clients.Elasticsea } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) @@ -429,7 +429,7 @@ public virtual Task InferenceAsync(Elastic.Clients.Elasticsea } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) @@ -440,7 +440,7 @@ public virtual Task InferenceAsync(Elastic.Clients.Elasticsea } /// - /// Perform inference on a model + /// Perform inference /// Learn more about this API in the Elasticsearch documentation. /// public virtual Task InferenceAsync(Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) @@ -452,140 +452,140 @@ public virtual Task InferenceAsync(Elastic.Clients.Elasticsea } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutModelResponse PutModel(PutModelRequest request) + public virtual PutInferenceResponse Put(PutInferenceRequest request) { request.BeforeRequest(); - return DoRequest(request); + return DoRequest(request); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task PutModelAsync(PutModelRequest request, CancellationToken cancellationToken = default) + public virtual Task PutAsync(PutInferenceRequest request, CancellationToken cancellationToken = default) { request.BeforeRequest(); - return DoRequestAsync(request, cancellationToken); + return DoRequestAsync(request, cancellationToken); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutModelResponse PutModel(PutModelRequestDescriptor descriptor) + public virtual PutInferenceResponse Put(PutInferenceRequestDescriptor descriptor) { descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutModelResponse PutModel(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new PutModelRequestDescriptor(modelConfig, taskType, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutModelResponse PutModel(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) { - var descriptor = new PutModelRequestDescriptor(modelConfig, taskType, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutModelResponse PutModel(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Id inferenceId) + public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId) { - var descriptor = new PutModelRequestDescriptor(modelConfig, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] - public virtual PutModelResponse PutModel(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) + public virtual PutInferenceResponse Put(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest) { - var descriptor = new PutModelRequestDescriptor(modelConfig, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequest(descriptor); + return DoRequest(descriptor); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task PutModelAsync(PutModelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + public virtual Task PutAsync(PutInferenceRequestDescriptor descriptor, CancellationToken cancellationToken = default) { descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task PutModelAsync(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) { - var descriptor = new PutModelRequestDescriptor(modelConfig, taskType, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task PutModelAsync(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Inference.TaskType? taskType, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) { - var descriptor = new PutModelRequestDescriptor(modelConfig, taskType, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, taskType, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task PutModelAsync(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) + public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, CancellationToken cancellationToken = default) { - var descriptor = new PutModelRequestDescriptor(modelConfig, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } /// - /// Configure a model for use in the Inference API + /// Configure an inference endpoint for use in the Inference API /// Learn more about this API in the Elasticsearch documentation. /// - public virtual Task PutModelAsync(Elastic.Clients.Elasticsearch.Inference.ModelConfig modelConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) + public virtual Task PutAsync(Elastic.Clients.Elasticsearch.Inference.InferenceEndpoint inferenceConfig, Elastic.Clients.Elasticsearch.Id inferenceId, Action configureRequest, CancellationToken cancellationToken = default) { - var descriptor = new PutModelRequestDescriptor(modelConfig, inferenceId); + var descriptor = new PutInferenceRequestDescriptor(inferenceConfig, inferenceId); configureRequest?.Invoke(descriptor); descriptor.BeforeRequest(); - return DoRequestAsync(descriptor, cancellationToken); + return DoRequestAsync(descriptor, cancellationToken); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs index 9d3e2d70797..1bb4d087579 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Ml.g.cs @@ -8668,6 +8668,96 @@ public virtual Task UpdateModelSnapshotAsync(Elasti return DoRequestAsync(descriptor, cancellationToken); } + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(UpdateTrainedModelDeploymentRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateTrainedModelDeploymentAsync(UpdateTrainedModelDeploymentRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(UpdateTrainedModelDeploymentRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId) + { + var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateTrainedModelDeploymentResponse UpdateTrainedModelDeployment(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest) + { + var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateTrainedModelDeploymentAsync(UpdateTrainedModelDeploymentRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// Updates certain properties of trained model deployment. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateTrainedModelDeploymentAsync(Elastic.Clients.Elasticsearch.Id modelId, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateTrainedModelDeploymentRequestDescriptor(modelId); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + /// /// Upgrades a given job snapshot to the current major version. /// Learn more about this API in the Elasticsearch documentation. diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs index da02e9adcd8..096a966d9d0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AdjacencyMatrixAggregation.g.cs @@ -35,6 +35,12 @@ public sealed partial class AdjacencyMatrixAggregation [JsonInclude, JsonPropertyName("filters")] public IDictionary? Filters { get; set; } + /// + /// Separator used to concatenate filter names. Defaults to &. + /// + [JsonInclude, JsonPropertyName("separator")] + public string? Separator { get; set; } + public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(AdjacencyMatrixAggregation adjacencyMatrixAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.AdjacencyMatrix(adjacencyMatrixAggregation); } @@ -47,6 +53,7 @@ public AdjacencyMatrixAggregationDescriptor() : base() } private IDictionary> FiltersValue { get; set; } + private string? SeparatorValue { get; set; } /// /// Filters used to create buckets.
At least one filter is required.
@@ -57,6 +64,15 @@ public AdjacencyMatrixAggregationDescriptor Filters(Func + /// Separator used to concatenate filter names. Defaults to &. + ///
+ public AdjacencyMatrixAggregationDescriptor Separator(string? separator) + { + SeparatorValue = separator; + return Self; + } + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -66,6 +82,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, FiltersValue, options); } + if (!string.IsNullOrEmpty(SeparatorValue)) + { + writer.WritePropertyName("separator"); + writer.WriteStringValue(SeparatorValue); + } + writer.WriteEndObject(); } } @@ -79,6 +101,7 @@ public AdjacencyMatrixAggregationDescriptor() : base() } private IDictionary FiltersValue { get; set; } + private string? SeparatorValue { get; set; } /// /// Filters used to create buckets.
At least one filter is required.
@@ -89,6 +112,15 @@ public AdjacencyMatrixAggregationDescriptor Filters(Func + /// Separator used to concatenate filter names. Defaults to &. + ///
+ public AdjacencyMatrixAggregationDescriptor Separator(string? separator) + { + SeparatorValue = separator; + return Self; + } + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); @@ -98,6 +130,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, FiltersValue, options); } + if (!string.IsNullOrEmpty(SeparatorValue)) + { + writer.WritePropertyName("separator"); + writer.WriteStringValue(SeparatorValue); + } + writer.WriteEndObject(); } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs index 688c3cce035..882f5c1ef9b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregationRange.g.cs @@ -33,7 +33,7 @@ public sealed partial class AggregationRange /// Start of the range (inclusive). ///
[JsonInclude, JsonPropertyName("from")] - public object? From { get; set; } + public double? From { get; set; } /// /// Custom key to return the range with. @@ -45,7 +45,7 @@ public sealed partial class AggregationRange /// End of the range (exclusive). /// [JsonInclude, JsonPropertyName("to")] - public object? To { get; set; } + public double? To { get; set; } } public sealed partial class AggregationRangeDescriptor : SerializableDescriptor @@ -56,14 +56,14 @@ public AggregationRangeDescriptor() : base() { } - private object? FromValue { get; set; } + private double? FromValue { get; set; } private string? KeyValue { get; set; } - private object? ToValue { get; set; } + private double? ToValue { get; set; } /// /// Start of the range (inclusive). /// - public AggregationRangeDescriptor From(object? from) + public AggregationRangeDescriptor From(double? from) { FromValue = from; return Self; @@ -81,7 +81,7 @@ public AggregationRangeDescriptor Key(string? key) /// /// End of the range (exclusive). /// - public AggregationRangeDescriptor To(object? to) + public AggregationRangeDescriptor To(double? to) { ToValue = to; return Self; @@ -90,10 +90,10 @@ public AggregationRangeDescriptor To(object? to) protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - if (FromValue is not null) + if (FromValue.HasValue) { writer.WritePropertyName("from"); - JsonSerializer.Serialize(writer, FromValue, options); + writer.WriteNumberValue(FromValue.Value); } if (!string.IsNullOrEmpty(KeyValue)) @@ -102,10 +102,10 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(KeyValue); } - if (ToValue is not null) + if (ToValue.HasValue) { writer.WritePropertyName("to"); - JsonSerializer.Serialize(writer, ToValue, options); + writer.WriteNumberValue(ToValue.Value); } writer.WriteEndObject(); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs index da1b504a596..7c706548130 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/Normalizers.g.cs @@ -93,8 +93,7 @@ public override INormalizer Read(ref Utf8JsonReader reader, Type typeToConvert, case "lowercase": return JsonSerializer.Deserialize(ref reader, options); default: - ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(INormalizer)); - return null; + return JsonSerializer.Deserialize(ref reader, options); } } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs index 27d285b9184..69d9babc174 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/PhoneticTokenFilter.g.cs @@ -32,6 +32,7 @@ public sealed partial class PhoneticTokenFilter : ITokenFilter [JsonInclude, JsonPropertyName("encoder")] public Elastic.Clients.Elasticsearch.Analysis.PhoneticEncoder Encoder { get; set; } [JsonInclude, JsonPropertyName("languageset")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Analysis.PhoneticLanguage))] public ICollection Languageset { get; set; } [JsonInclude, JsonPropertyName("max_code_len")] public int? MaxCodeLen { get; set; } @@ -113,7 +114,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WritePropertyName("encoder"); JsonSerializer.Serialize(writer, EncoderValue, options); writer.WritePropertyName("languageset"); - JsonSerializer.Serialize(writer, LanguagesetValue, options); + SingleOrManySerializationHelper.Serialize(LanguagesetValue, writer, options); if (MaxCodeLenValue.HasValue) { writer.WritePropertyName("max_code_len"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs index e1aa232055d..324ab6438a7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Mapping.g.cs @@ -87,6 +87,8 @@ public override void Write(Utf8JsonWriter writer, DynamicMapping value, JsonSeri [JsonConverter(typeof(FieldTypeConverter))] public enum FieldType { + [EnumMember(Value = "version")] + Version, [EnumMember(Value = "token_count")] TokenCount, [EnumMember(Value = "text")] @@ -182,6 +184,8 @@ public override FieldType Read(ref Utf8JsonReader reader, Type typeToConvert, Js var enumString = reader.GetString(); switch (enumString) { + case "version": + return FieldType.Version; case "token_count": return FieldType.TokenCount; case "text": @@ -278,6 +282,9 @@ public override void Write(Utf8JsonWriter writer, FieldType value, JsonSerialize { switch (value) { + case FieldType.Version: + writer.WriteStringValue("version"); + return; case FieldType.TokenCount: writer.WriteStringValue("token_count"); return; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ModelConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpoint.g.cs similarity index 78% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ModelConfig.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpoint.g.cs index 705bea0b654..23c71668389 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ModelConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpoint.g.cs @@ -28,9 +28,9 @@ namespace Elastic.Clients.Elasticsearch.Inference; /// -/// Configuration options when storing the model config +/// Configuration options when storing the inference endpoint /// -public sealed partial class ModelConfig +public sealed partial class InferenceEndpoint { /// /// The service type @@ -45,20 +45,20 @@ public sealed partial class ModelConfig public object ServiceSettings { get; set; } /// - /// Task settings specific to the service and model + /// Task settings specific to the service and task type /// [JsonInclude, JsonPropertyName("task_settings")] public object TaskSettings { get; set; } } /// -/// Configuration options when storing the model config +/// Configuration options when storing the inference endpoint /// -public sealed partial class ModelConfigDescriptor : SerializableDescriptor +public sealed partial class InferenceEndpointDescriptor : SerializableDescriptor { - internal ModelConfigDescriptor(Action configure) => configure.Invoke(this); + internal InferenceEndpointDescriptor(Action configure) => configure.Invoke(this); - public ModelConfigDescriptor() : base() + public InferenceEndpointDescriptor() : base() { } @@ -69,7 +69,7 @@ public ModelConfigDescriptor() : base() /// /// The service type /// - public ModelConfigDescriptor Service(string service) + public InferenceEndpointDescriptor Service(string service) { ServiceValue = service; return Self; @@ -78,16 +78,16 @@ public ModelConfigDescriptor Service(string service) /// /// Settings specific to the service /// - public ModelConfigDescriptor ServiceSettings(object serviceSettings) + public InferenceEndpointDescriptor ServiceSettings(object serviceSettings) { ServiceSettingsValue = serviceSettings; return Self; } /// - /// Task settings specific to the service and model + /// Task settings specific to the service and task type /// - public ModelConfigDescriptor TaskSettings(object taskSettings) + public InferenceEndpointDescriptor TaskSettings(object taskSettings) { TaskSettingsValue = taskSettings; return Self; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ModelConfigContainer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpointInfo.g.cs similarity index 85% rename from src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ModelConfigContainer.g.cs rename to src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpointInfo.g.cs index 5059120cb46..2b92e3219c3 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/ModelConfigContainer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Inference/InferenceEndpointInfo.g.cs @@ -28,15 +28,15 @@ namespace Elastic.Clients.Elasticsearch.Inference; /// -/// Represents a model as returned by the GET API +/// Represents an inference endpoint as returned by the GET API /// -public sealed partial class ModelConfigContainer +public sealed partial class InferenceEndpointInfo { /// - /// The model Id + /// The inference Id /// - [JsonInclude, JsonPropertyName("model_id")] - public string ModelId { get; init; } + [JsonInclude, JsonPropertyName("inference_id")] + public string InferenceId { get; init; } /// /// The service type @@ -51,13 +51,13 @@ public sealed partial class ModelConfigContainer public object ServiceSettings { get; init; } /// - /// Task settings specific to the service and model + /// Task settings specific to the service and task type /// [JsonInclude, JsonPropertyName("task_settings")] public object TaskSettings { get; init; } /// - /// The model's task type + /// The task type /// [JsonInclude, JsonPropertyName("task_type")] public Elastic.Clients.Elasticsearch.Inference.TaskType TaskType { get; init; } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs index a673dca0c16..6d6fef74731 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Ingest/RemoveProcessor.g.cs @@ -60,6 +60,13 @@ public sealed partial class RemoveProcessor [JsonInclude, JsonPropertyName("ignore_missing")] public bool? IgnoreMissing { get; set; } + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + [JsonInclude, JsonPropertyName("keep")] + [JsonConverter(typeof(SingleOrManyFieldsConverter))] + public Elastic.Clients.Elasticsearch.Fields? Keep { get; set; } + /// /// Handle failures for the processor. /// @@ -88,6 +95,7 @@ public RemoveProcessorDescriptor() : base() private string? IfValue { get; set; } private bool? IgnoreFailureValue { get; set; } private bool? IgnoreMissingValue { get; set; } + private Elastic.Clients.Elasticsearch.Fields? KeepValue { get; set; } private ICollection? OnFailureValue { get; set; } private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } private Action> OnFailureDescriptorAction { get; set; } @@ -139,6 +147,15 @@ public RemoveProcessorDescriptor IgnoreMissing(bool? ignoreMissing = return Self; } + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + public RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Fields? keep) + { + KeepValue = keep; + return Self; + } + /// /// Handle failures for the processor. /// @@ -216,6 +233,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteBooleanValue(IgnoreMissingValue.Value); } + if (KeepValue is not null) + { + writer.WritePropertyName("keep"); + JsonSerializer.Serialize(writer, KeepValue, options); + } + if (OnFailureDescriptor is not null) { writer.WritePropertyName("on_failure"); @@ -270,6 +293,7 @@ public RemoveProcessorDescriptor() : base() private string? IfValue { get; set; } private bool? IgnoreFailureValue { get; set; } private bool? IgnoreMissingValue { get; set; } + private Elastic.Clients.Elasticsearch.Fields? KeepValue { get; set; } private ICollection? OnFailureValue { get; set; } private Elastic.Clients.Elasticsearch.Ingest.ProcessorDescriptor OnFailureDescriptor { get; set; } private Action OnFailureDescriptorAction { get; set; } @@ -321,6 +345,15 @@ public RemoveProcessorDescriptor IgnoreMissing(bool? ignoreMissing = true) return Self; } + /// + /// Fields to be kept. When set, all fields other than those specified are removed. + /// + public RemoveProcessorDescriptor Keep(Elastic.Clients.Elasticsearch.Fields? keep) + { + KeepValue = keep; + return Self; + } + /// /// Handle failures for the processor. /// @@ -398,6 +431,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteBooleanValue(IgnoreMissingValue.Value); } + if (KeepValue is not null) + { + writer.WritePropertyName("keep"); + JsonSerializer.Serialize(writer, KeepValue, options); + } + if (OnFailureDescriptor is not null) { writer.WritePropertyName("on_failure"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs index 760d2b8113a..70484f24595 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs @@ -52,7 +52,7 @@ public sealed partial class KnnQuery /// The number of nearest neighbor candidates to consider per shard /// [JsonInclude, JsonPropertyName("num_candidates")] - public long? NumCandidates { get; set; } + public int? NumCandidates { get; set; } [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } @@ -91,7 +91,7 @@ public KnnQueryDescriptor() : base() private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } private Action> FilterDescriptorAction { get; set; } private Action>[] FilterDescriptorActions { get; set; } - private long? NumCandidatesValue { get; set; } + private int? NumCandidatesValue { get; set; } private string? QueryNameValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } @@ -177,7 +177,7 @@ public KnnQueryDescriptor Filter(params Action /// The number of nearest neighbor candidates to consider per shard /// - public KnnQueryDescriptor NumCandidates(long? numCandidates) + public KnnQueryDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; @@ -332,7 +332,7 @@ public KnnQueryDescriptor() : base() private Elastic.Clients.Elasticsearch.QueryDsl.QueryDescriptor FilterDescriptor { get; set; } private Action FilterDescriptorAction { get; set; } private Action[] FilterDescriptorActions { get; set; } - private long? NumCandidatesValue { get; set; } + private int? NumCandidatesValue { get; set; } private string? QueryNameValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } @@ -418,7 +418,7 @@ public KnnQueryDescriptor Filter(params Action /// The number of nearest neighbor candidates to consider per shard ///
- public KnnQueryDescriptor NumCandidates(long? numCandidates) + public KnnQueryDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs index 31654f91bd5..b83a98fa2f7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnSearch.g.cs @@ -58,13 +58,13 @@ public sealed partial class KnnSearch /// The final number of nearest neighbors to return as top hits ///
[JsonInclude, JsonPropertyName("k")] - public long? k { get; set; } + public int? k { get; set; } /// /// The number of nearest neighbor candidates to consider per shard /// [JsonInclude, JsonPropertyName("num_candidates")] - public long? NumCandidates { get; set; } + public int? NumCandidates { get; set; } /// /// The query vector @@ -102,8 +102,8 @@ public KnnSearchDescriptor() : base() private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } private Action> InnerHitsDescriptorAction { get; set; } - private long? kValue { get; set; } - private long? NumCandidatesValue { get; set; } + private int? kValue { get; set; } + private int? NumCandidatesValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } @@ -215,7 +215,7 @@ public KnnSearchDescriptor InnerHits(Action /// The final number of nearest neighbors to return as top hits /// - public KnnSearchDescriptor k(long? k) + public KnnSearchDescriptor k(int? k) { kValue = k; return Self; @@ -224,7 +224,7 @@ public KnnSearchDescriptor k(long? k) /// /// The number of nearest neighbor candidates to consider per shard /// - public KnnSearchDescriptor NumCandidates(long? numCandidates) + public KnnSearchDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; @@ -392,8 +392,8 @@ public KnnSearchDescriptor() : base() private Elastic.Clients.Elasticsearch.Core.Search.InnerHits? InnerHitsValue { get; set; } private Elastic.Clients.Elasticsearch.Core.Search.InnerHitsDescriptor InnerHitsDescriptor { get; set; } private Action InnerHitsDescriptorAction { get; set; } - private long? kValue { get; set; } - private long? NumCandidatesValue { get; set; } + private int? kValue { get; set; } + private int? NumCandidatesValue { get; set; } private ICollection? QueryVectorValue { get; set; } private Elastic.Clients.Elasticsearch.QueryVectorBuilder? QueryVectorBuilderValue { get; set; } private Elastic.Clients.Elasticsearch.QueryVectorBuilderDescriptor QueryVectorBuilderDescriptor { get; set; } @@ -505,7 +505,7 @@ public KnnSearchDescriptor InnerHits(Action /// The final number of nearest neighbors to return as top hits ///
- public KnnSearchDescriptor k(long? k) + public KnnSearchDescriptor k(int? k) { kValue = k; return Self; @@ -514,7 +514,7 @@ public KnnSearchDescriptor k(long? k) /// /// The number of nearest neighbor candidates to consider per shard /// - public KnnSearchDescriptor NumCandidates(long? numCandidates) + public KnnSearchDescriptor NumCandidates(int? numCandidates) { NumCandidatesValue = numCandidates; return Self; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs index 82424e9a47c..5234147736b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DenseVectorProperty.g.cs @@ -33,6 +33,8 @@ public sealed partial class DenseVectorProperty : IProperty public int? Dims { get; set; } [JsonInclude, JsonPropertyName("dynamic")] public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; } + [JsonInclude, JsonPropertyName("element_type")] + public string? ElementType { get; set; } [JsonInclude, JsonPropertyName("fields")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; } [JsonInclude, JsonPropertyName("ignore_above")] @@ -66,6 +68,7 @@ public DenseVectorPropertyDescriptor() : base() private int? DimsValue { get; set; } private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } + private string? ElementTypeValue { get; set; } private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } private int? IgnoreAboveValue { get; set; } private bool? IndexValue { get; set; } @@ -88,6 +91,12 @@ public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elastics return Self; } + public DenseVectorPropertyDescriptor ElementType(string? elementType) + { + ElementTypeValue = elementType; + return Self; + } + public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) { FieldsValue = fields; @@ -194,6 +203,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, DynamicValue, options); } + if (!string.IsNullOrEmpty(ElementTypeValue)) + { + writer.WritePropertyName("element_type"); + writer.WriteStringValue(ElementTypeValue); + } + if (FieldsValue is not null) { writer.WritePropertyName("fields"); @@ -279,6 +294,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o { Dims = DimsValue, Dynamic = DynamicValue, + ElementType = ElementTypeValue, Fields = FieldsValue, IgnoreAbove = IgnoreAboveValue, Index = IndexValue, @@ -299,6 +315,7 @@ public DenseVectorPropertyDescriptor() : base() private int? DimsValue { get; set; } private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; } + private string? ElementTypeValue { get; set; } private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; } private int? IgnoreAboveValue { get; set; } private bool? IndexValue { get; set; } @@ -321,6 +338,12 @@ public DenseVectorPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mappi return Self; } + public DenseVectorPropertyDescriptor ElementType(string? elementType) + { + ElementTypeValue = elementType; + return Self; + } + public DenseVectorPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields) { FieldsValue = fields; @@ -427,6 +450,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, DynamicValue, options); } + if (!string.IsNullOrEmpty(ElementTypeValue)) + { + writer.WritePropertyName("element_type"); + writer.WriteStringValue(ElementTypeValue); + } + if (FieldsValue is not null) { writer.WritePropertyName("fields"); @@ -512,6 +541,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o { Dims = DimsValue, Dynamic = DynamicValue, + ElementType = ElementTypeValue, Fields = FieldsValue, IgnoreAbove = IgnoreAboveValue, Index = IndexValue, diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs index b55b842998d..b9d89e78397 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/DynamicTemplate.g.cs @@ -21,28 +21,231 @@ using Elastic.Clients.Elasticsearch.Serialization; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; namespace Elastic.Clients.Elasticsearch.Mapping; +[JsonConverter(typeof(DynamicTemplateConverter))] public sealed partial class DynamicTemplate { - [JsonInclude, JsonPropertyName("mapping")] - public Elastic.Clients.Elasticsearch.Mapping.IProperty? Mapping { get; set; } + internal DynamicTemplate(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static DynamicTemplate Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => new DynamicTemplate("mapping", property); + public static DynamicTemplate Runtime(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => new DynamicTemplate("runtime", property); + [JsonInclude, JsonPropertyName("match")] - public string? Match { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? Match { get; set; } [JsonInclude, JsonPropertyName("match_mapping_type")] - public string? MatchMappingType { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? MatchMappingType { get; set; } [JsonInclude, JsonPropertyName("match_pattern")] public Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPattern { get; set; } [JsonInclude, JsonPropertyName("path_match")] - public string? PathMatch { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? PathMatch { get; set; } [JsonInclude, JsonPropertyName("path_unmatch")] - public string? PathUnmatch { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? PathUnmatch { get; set; } [JsonInclude, JsonPropertyName("unmatch")] - public string? Unmatch { get; set; } + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? Unmatch { get; set; } + [JsonInclude, JsonPropertyName("unmatch_mapping_type")] + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? UnmatchMappingType { get; set; } + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class DynamicTemplateConverter : JsonConverter +{ + public override DynamicTemplate Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + ICollection? matchValue = default; + ICollection? matchMappingTypeValue = default; + Elastic.Clients.Elasticsearch.Mapping.MatchType? matchPatternValue = default; + ICollection? pathMatchValue = default; + ICollection? pathUnmatchValue = default; + ICollection? unmatchValue = default; + ICollection? unmatchMappingTypeValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "match") + { + matchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "match_mapping_type") + { + matchMappingTypeValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "match_pattern") + { + matchPatternValue = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (propertyName == "path_match") + { + pathMatchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "path_unmatch") + { + pathUnmatchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "unmatch") + { + unmatchValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "unmatch_mapping_type") + { + unmatchMappingTypeValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "mapping") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "runtime") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'DynamicTemplate' from the response."); + } + + var result = new DynamicTemplate(variantNameValue, variantValue); + result.Match = matchValue; + result.MatchMappingType = matchMappingTypeValue; + result.MatchPattern = matchPatternValue; + result.PathMatch = pathMatchValue; + result.PathUnmatch = pathUnmatchValue; + result.Unmatch = unmatchValue; + result.UnmatchMappingType = unmatchMappingTypeValue; + return result; + } + + public override void Write(Utf8JsonWriter writer, DynamicTemplate value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Match is not null) + { + writer.WritePropertyName("match"); + SingleOrManySerializationHelper.Serialize(value.Match, writer, options); + } + + if (value.MatchMappingType is not null) + { + writer.WritePropertyName("match_mapping_type"); + SingleOrManySerializationHelper.Serialize(value.MatchMappingType, writer, options); + } + + if (value.MatchPattern is not null) + { + writer.WritePropertyName("match_pattern"); + JsonSerializer.Serialize(writer, value.MatchPattern, options); + } + + if (value.PathMatch is not null) + { + writer.WritePropertyName("path_match"); + SingleOrManySerializationHelper.Serialize(value.PathMatch, writer, options); + } + + if (value.PathUnmatch is not null) + { + writer.WritePropertyName("path_unmatch"); + SingleOrManySerializationHelper.Serialize(value.PathUnmatch, writer, options); + } + + if (value.Unmatch is not null) + { + writer.WritePropertyName("unmatch"); + SingleOrManySerializationHelper.Serialize(value.Unmatch, writer, options); + } + + if (value.UnmatchMappingType is not null) + { + writer.WritePropertyName("unmatch_mapping_type"); + SingleOrManySerializationHelper.Serialize(value.UnmatchMappingType, writer, options); + } + + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "mapping": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Mapping.IProperty)value.Variant, options); + break; + case "runtime": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Mapping.IProperty)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } } public sealed partial class DynamicTemplateDescriptor : SerializableDescriptor> @@ -53,27 +256,44 @@ public DynamicTemplateDescriptor() : base() { } - private Elastic.Clients.Elasticsearch.Mapping.IProperty? MappingValue { get; set; } - private string? MatchValue { get; set; } - private string? MatchMappingTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPatternValue { get; set; } - private string? PathMatchValue { get; set; } - private string? PathUnmatchValue { get; set; } - private string? UnmatchValue { get; set; } + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } - public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty? mapping) + private DynamicTemplateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor { - MappingValue = mapping; + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; return Self; } - public DynamicTemplateDescriptor Match(string? match) + private DynamicTemplateDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + private ICollection? MatchValue { get; set; } + private ICollection? MatchMappingTypeValue { get; set; } + private Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPatternValue { get; set; } + private ICollection? PathMatchValue { get; set; } + private ICollection? PathUnmatchValue { get; set; } + private ICollection? UnmatchValue { get; set; } + private ICollection? UnmatchMappingTypeValue { get; set; } + + public DynamicTemplateDescriptor Match(ICollection? match) { MatchValue = match; return Self; } - public DynamicTemplateDescriptor MatchMappingType(string? matchMappingType) + public DynamicTemplateDescriptor MatchMappingType(ICollection? matchMappingType) { MatchMappingTypeValue = matchMappingType; return Self; @@ -85,43 +305,46 @@ public DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elastic return Self; } - public DynamicTemplateDescriptor PathMatch(string? pathMatch) + public DynamicTemplateDescriptor PathMatch(ICollection? pathMatch) { PathMatchValue = pathMatch; return Self; } - public DynamicTemplateDescriptor PathUnmatch(string? pathUnmatch) + public DynamicTemplateDescriptor PathUnmatch(ICollection? pathUnmatch) { PathUnmatchValue = pathUnmatch; return Self; } - public DynamicTemplateDescriptor Unmatch(string? unmatch) + public DynamicTemplateDescriptor Unmatch(ICollection? unmatch) { UnmatchValue = unmatch; return Self; } + public DynamicTemplateDescriptor UnmatchMappingType(ICollection? unmatchMappingType) + { + UnmatchMappingTypeValue = unmatchMappingType; + return Self; + } + + public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "mapping"); + public DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "runtime"); + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - if (MappingValue is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingValue, options); - } - - if (!string.IsNullOrEmpty(MatchValue)) + if (MatchValue is not null) { writer.WritePropertyName("match"); - writer.WriteStringValue(MatchValue); + SingleOrManySerializationHelper.Serialize(MatchValue, writer, options); } - if (!string.IsNullOrEmpty(MatchMappingTypeValue)) + if (MatchMappingTypeValue is not null) { writer.WritePropertyName("match_mapping_type"); - writer.WriteStringValue(MatchMappingTypeValue); + SingleOrManySerializationHelper.Serialize(MatchMappingTypeValue, writer, options); } if (MatchPatternValue is not null) @@ -130,22 +353,41 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, MatchPatternValue, options); } - if (!string.IsNullOrEmpty(PathMatchValue)) + if (PathMatchValue is not null) { writer.WritePropertyName("path_match"); - writer.WriteStringValue(PathMatchValue); + SingleOrManySerializationHelper.Serialize(PathMatchValue, writer, options); } - if (!string.IsNullOrEmpty(PathUnmatchValue)) + if (PathUnmatchValue is not null) { writer.WritePropertyName("path_unmatch"); - writer.WriteStringValue(PathUnmatchValue); + SingleOrManySerializationHelper.Serialize(PathUnmatchValue, writer, options); } - if (!string.IsNullOrEmpty(UnmatchValue)) + if (UnmatchValue is not null) { writer.WritePropertyName("unmatch"); - writer.WriteStringValue(UnmatchValue); + SingleOrManySerializationHelper.Serialize(UnmatchValue, writer, options); + } + + if (UnmatchMappingTypeValue is not null) + { + writer.WritePropertyName("unmatch_mapping_type"); + SingleOrManySerializationHelper.Serialize(UnmatchMappingTypeValue, writer, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); } writer.WriteEndObject(); @@ -160,27 +402,44 @@ public DynamicTemplateDescriptor() : base() { } - private Elastic.Clients.Elasticsearch.Mapping.IProperty? MappingValue { get; set; } - private string? MatchValue { get; set; } - private string? MatchMappingTypeValue { get; set; } - private Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPatternValue { get; set; } - private string? PathMatchValue { get; set; } - private string? PathUnmatchValue { get; set; } - private string? UnmatchValue { get; set; } + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private DynamicTemplateDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } - public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty? mapping) + private DynamicTemplateDescriptor Set(object variant, string variantName) { - MappingValue = mapping; + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; return Self; } - public DynamicTemplateDescriptor Match(string? match) + private ICollection? MatchValue { get; set; } + private ICollection? MatchMappingTypeValue { get; set; } + private Elastic.Clients.Elasticsearch.Mapping.MatchType? MatchPatternValue { get; set; } + private ICollection? PathMatchValue { get; set; } + private ICollection? PathUnmatchValue { get; set; } + private ICollection? UnmatchValue { get; set; } + private ICollection? UnmatchMappingTypeValue { get; set; } + + public DynamicTemplateDescriptor Match(ICollection? match) { MatchValue = match; return Self; } - public DynamicTemplateDescriptor MatchMappingType(string? matchMappingType) + public DynamicTemplateDescriptor MatchMappingType(ICollection? matchMappingType) { MatchMappingTypeValue = matchMappingType; return Self; @@ -192,43 +451,46 @@ public DynamicTemplateDescriptor MatchPattern(Elastic.Clients.Elasticsearch.Mapp return Self; } - public DynamicTemplateDescriptor PathMatch(string? pathMatch) + public DynamicTemplateDescriptor PathMatch(ICollection? pathMatch) { PathMatchValue = pathMatch; return Self; } - public DynamicTemplateDescriptor PathUnmatch(string? pathUnmatch) + public DynamicTemplateDescriptor PathUnmatch(ICollection? pathUnmatch) { PathUnmatchValue = pathUnmatch; return Self; } - public DynamicTemplateDescriptor Unmatch(string? unmatch) + public DynamicTemplateDescriptor Unmatch(ICollection? unmatch) { UnmatchValue = unmatch; return Self; } + public DynamicTemplateDescriptor UnmatchMappingType(ICollection? unmatchMappingType) + { + UnmatchMappingTypeValue = unmatchMappingType; + return Self; + } + + public DynamicTemplateDescriptor Mapping(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "mapping"); + public DynamicTemplateDescriptor Runtime(Elastic.Clients.Elasticsearch.Mapping.IProperty property) => Set(property, "runtime"); + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) { writer.WriteStartObject(); - if (MappingValue is not null) - { - writer.WritePropertyName("mapping"); - JsonSerializer.Serialize(writer, MappingValue, options); - } - - if (!string.IsNullOrEmpty(MatchValue)) + if (MatchValue is not null) { writer.WritePropertyName("match"); - writer.WriteStringValue(MatchValue); + SingleOrManySerializationHelper.Serialize(MatchValue, writer, options); } - if (!string.IsNullOrEmpty(MatchMappingTypeValue)) + if (MatchMappingTypeValue is not null) { writer.WritePropertyName("match_mapping_type"); - writer.WriteStringValue(MatchMappingTypeValue); + SingleOrManySerializationHelper.Serialize(MatchMappingTypeValue, writer, options); } if (MatchPatternValue is not null) @@ -237,22 +499,41 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, MatchPatternValue, options); } - if (!string.IsNullOrEmpty(PathMatchValue)) + if (PathMatchValue is not null) { writer.WritePropertyName("path_match"); - writer.WriteStringValue(PathMatchValue); + SingleOrManySerializationHelper.Serialize(PathMatchValue, writer, options); } - if (!string.IsNullOrEmpty(PathUnmatchValue)) + if (PathUnmatchValue is not null) { writer.WritePropertyName("path_unmatch"); - writer.WriteStringValue(PathUnmatchValue); + SingleOrManySerializationHelper.Serialize(PathUnmatchValue, writer, options); } - if (!string.IsNullOrEmpty(UnmatchValue)) + if (UnmatchValue is not null) { writer.WritePropertyName("unmatch"); - writer.WriteStringValue(UnmatchValue); + SingleOrManySerializationHelper.Serialize(UnmatchValue, writer, options); + } + + if (UnmatchMappingTypeValue is not null) + { + writer.WritePropertyName("unmatch_mapping_type"); + SingleOrManySerializationHelper.Serialize(UnmatchMappingTypeValue, writer, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); } writer.WriteEndObject(); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs index 5a85a185b03..0ba23517f4c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/KeywordProperty.g.cs @@ -60,8 +60,12 @@ public sealed partial class KeywordProperty : IProperty public bool? Norms { get; set; } [JsonInclude, JsonPropertyName("null_value")] public string? NullValue { get; set; } + [JsonInclude, JsonPropertyName("on_script_error")] + public Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptError { get; set; } [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } + [JsonInclude, JsonPropertyName("script")] + public Elastic.Clients.Elasticsearch.Script? Script { get; set; } [JsonInclude, JsonPropertyName("similarity")] public string? Similarity { get; set; } [JsonInclude, JsonPropertyName("split_queries_on_whitespace")] @@ -100,7 +104,9 @@ public KeywordPropertyDescriptor() : base() private string? NormalizerValue { get; set; } private bool? NormsValue { get; set; } private string? NullValueValue { get; set; } + private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } + private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } private string? SimilarityValue { get; set; } private bool? SplitQueriesOnWhitespaceValue { get; set; } private bool? StoreValue { get; set; } @@ -201,6 +207,12 @@ public KeywordPropertyDescriptor NullValue(string? nullValue) return Self; } + public KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + { + OnScriptErrorValue = onScriptError; + return Self; + } + public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) { PropertiesValue = properties; @@ -221,6 +233,12 @@ public KeywordPropertyDescriptor Properties(Action Script(Elastic.Clients.Elasticsearch.Script? script) + { + ScriptValue = script; + return Self; + } + public KeywordPropertyDescriptor Similarity(string? similarity) { SimilarityValue = similarity; @@ -329,12 +347,24 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteStringValue(NullValueValue); } + if (OnScriptErrorValue is not null) + { + writer.WritePropertyName("on_script_error"); + JsonSerializer.Serialize(writer, OnScriptErrorValue, options); + } + if (PropertiesValue is not null) { writer.WritePropertyName("properties"); JsonSerializer.Serialize(writer, PropertiesValue, options); } + if (ScriptValue is not null) + { + writer.WritePropertyName("script"); + JsonSerializer.Serialize(writer, ScriptValue, options); + } + if (!string.IsNullOrEmpty(SimilarityValue)) { writer.WritePropertyName("similarity"); @@ -379,7 +409,9 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o Normalizer = NormalizerValue, Norms = NormsValue, NullValue = NullValueValue, + OnScriptError = OnScriptErrorValue, Properties = PropertiesValue, + Script = ScriptValue, Similarity = SimilarityValue, SplitQueriesOnWhitespace = SplitQueriesOnWhitespaceValue, Store = StoreValue, @@ -408,7 +440,9 @@ public KeywordPropertyDescriptor() : base() private string? NormalizerValue { get; set; } private bool? NormsValue { get; set; } private string? NullValueValue { get; set; } + private Elastic.Clients.Elasticsearch.Mapping.OnScriptError? OnScriptErrorValue { get; set; } private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } + private Elastic.Clients.Elasticsearch.Script? ScriptValue { get; set; } private string? SimilarityValue { get; set; } private bool? SplitQueriesOnWhitespaceValue { get; set; } private bool? StoreValue { get; set; } @@ -509,6 +543,12 @@ public KeywordPropertyDescriptor NullValue(string? nullValue) return Self; } + public KeywordPropertyDescriptor OnScriptError(Elastic.Clients.Elasticsearch.Mapping.OnScriptError? onScriptError) + { + OnScriptErrorValue = onScriptError; + return Self; + } + public KeywordPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) { PropertiesValue = properties; @@ -529,6 +569,12 @@ public KeywordPropertyDescriptor Properties(Action new Query("constant_score", constantScoreQuery); public static Query DisMax(Elastic.Clients.Elasticsearch.QueryDsl.DisMaxQuery disMaxQuery) => new Query("dis_max", disMaxQuery); public static Query Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => new Query("exists", existsQuery); - public static Query FieldMaskingSpan(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new Query("field_masking_span", spanFieldMaskingQuery); public static Query FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery functionScoreQuery) => new Query("function_score", functionScoreQuery); public static Query Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery fuzzyQuery) => new Query("fuzzy", fuzzyQuery); public static Query GeoBoundingBox(Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery geoBoundingBoxQuery) => new Query("geo_bounding_box", geoBoundingBoxQuery); @@ -89,6 +88,7 @@ internal Query(string variantName, object variant) public static Query ScriptScore(Elastic.Clients.Elasticsearch.QueryDsl.ScriptScoreQuery scriptScoreQuery) => new Query("script_score", scriptScoreQuery); public static Query SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new Query("simple_query_string", simpleQueryStringQuery); public static Query SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => new Query("span_containing", spanContainingQuery); + public static Query SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new Query("span_field_masking", spanFieldMaskingQuery); public static Query SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => new Query("span_first", spanFirstQuery); public static Query SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => new Query("span_multi", spanMultiTermQuery); public static Query SpanNear(Elastic.Clients.Elasticsearch.QueryDsl.SpanNearQuery spanNearQuery) => new Query("span_near", spanNearQuery); @@ -184,13 +184,6 @@ public override Query Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe continue; } - if (propertyName == "field_masking_span") - { - variantValue = JsonSerializer.Deserialize(ref reader, options); - variantNameValue = propertyName; - continue; - } - if (propertyName == "function_score") { variantValue = JsonSerializer.Deserialize(ref reader, options); @@ -422,6 +415,13 @@ public override Query Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe continue; } + if (propertyName == "span_field_masking") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + if (propertyName == "span_first") { variantValue = JsonSerializer.Deserialize(ref reader, options); @@ -553,9 +553,6 @@ public override void Write(Utf8JsonWriter writer, Query value, JsonSerializerOpt case "exists": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, options); break; - case "field_masking_span": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); - break; case "function_score": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery)value.Variant, options); break; @@ -655,6 +652,9 @@ public override void Write(Utf8JsonWriter writer, Query value, JsonSerializerOpt case "span_containing": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery)value.Variant, options); break; + case "span_field_masking": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); + break; case "span_first": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery)value.Variant, options); break; @@ -747,8 +747,6 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor DisMax(Action> configure) => Set(configure, "dis_max"); public QueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); public QueryDescriptor Exists(Action> configure) => Set(configure, "exists"); - public QueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public QueryDescriptor FieldMaskingSpan(Action> configure) => Set(configure, "field_masking_span"); public QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery functionScoreQuery) => Set(functionScoreQuery, "function_score"); public QueryDescriptor FunctionScore(Action> configure) => Set(configure, "function_score"); public QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); @@ -813,6 +811,8 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); public QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public QueryDescriptor SpanContaining(Action> configure) => Set(configure, "span_containing"); + public QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public QueryDescriptor SpanFieldMasking(Action> configure) => Set(configure, "span_field_masking"); public QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public QueryDescriptor SpanFirst(Action> configure) => Set(configure, "span_first"); public QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); @@ -905,8 +905,6 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor DisMax(Action configure) => Set(configure, "dis_max"); public QueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); public QueryDescriptor Exists(Action configure) => Set(configure, "exists"); - public QueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public QueryDescriptor FieldMaskingSpan(Action configure) => Set(configure, "field_masking_span"); public QueryDescriptor FunctionScore(Elastic.Clients.Elasticsearch.QueryDsl.FunctionScoreQuery functionScoreQuery) => Set(functionScoreQuery, "function_score"); public QueryDescriptor FunctionScore(Action configure) => Set(configure, "function_score"); public QueryDescriptor Fuzzy(Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); @@ -971,6 +969,8 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); public QueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public QueryDescriptor SpanContaining(Action configure) => Set(configure, "span_containing"); + public QueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public QueryDescriptor SpanFieldMasking(Action configure) => Set(configure, "span_field_masking"); public QueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public QueryDescriptor SpanFirst(Action configure) => Set(configure, "span_first"); public QueryDescriptor SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => Set(spanMultiTermQuery, "span_multi"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs index 802c292739a..02cd992f530 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanFieldMaskingQuery.g.cs @@ -41,8 +41,8 @@ public sealed partial class SpanFieldMaskingQuery [JsonInclude, JsonPropertyName("_name")] public string? QueryName { get; set; } - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.FieldMaskingSpan(spanFieldMaskingQuery); - public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.FieldMaskingSpan(spanFieldMaskingQuery); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SpanFieldMasking(spanFieldMaskingQuery); + public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery(SpanFieldMaskingQuery spanFieldMaskingQuery) => Elastic.Clients.Elasticsearch.QueryDsl.SpanQuery.SpanFieldMasking(spanFieldMaskingQuery); } public sealed partial class SpanFieldMaskingQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs index f48e07f6f7e..68096795d8c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SpanQuery.g.cs @@ -46,8 +46,8 @@ internal SpanQuery(string variantName, object variant) internal object Variant { get; } internal string VariantName { get; } - public static SpanQuery FieldMaskingSpan(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new SpanQuery("field_masking_span", spanFieldMaskingQuery); public static SpanQuery SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => new SpanQuery("span_containing", spanContainingQuery); + public static SpanQuery SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => new SpanQuery("span_field_masking", spanFieldMaskingQuery); public static SpanQuery SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => new SpanQuery("span_first", spanFirstQuery); public static SpanQuery SpanGap(KeyValuePair integer) => new SpanQuery("span_gap", integer); public static SpanQuery SpanMulti(Elastic.Clients.Elasticsearch.QueryDsl.SpanMultiTermQuery spanMultiTermQuery) => new SpanQuery("span_multi", spanMultiTermQuery); @@ -95,16 +95,16 @@ public override SpanQuery Read(ref Utf8JsonReader reader, Type typeToConvert, Js var propertyName = reader.GetString(); reader.Read(); - if (propertyName == "field_masking_span") + if (propertyName == "span_containing") { - variantValue = JsonSerializer.Deserialize(ref reader, options); + variantValue = JsonSerializer.Deserialize(ref reader, options); variantNameValue = propertyName; continue; } - if (propertyName == "span_containing") + if (propertyName == "span_field_masking") { - variantValue = JsonSerializer.Deserialize(ref reader, options); + variantValue = JsonSerializer.Deserialize(ref reader, options); variantNameValue = propertyName; continue; } @@ -180,12 +180,12 @@ public override void Write(Utf8JsonWriter writer, SpanQuery value, JsonSerialize writer.WritePropertyName(value.VariantName); switch (value.VariantName) { - case "field_masking_span": - JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); - break; case "span_containing": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery)value.Variant, options); break; + case "span_field_masking": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery)value.Variant, options); + break; case "span_first": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery)value.Variant, options); break; @@ -248,10 +248,10 @@ private SpanQueryDescriptor Set(object variant, string variantName) return Self; } - public SpanQueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public SpanQueryDescriptor FieldMaskingSpan(Action> configure) => Set(configure, "field_masking_span"); public SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public SpanQueryDescriptor SpanContaining(Action> configure) => Set(configure, "span_containing"); + public SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public SpanQueryDescriptor SpanFieldMasking(Action> configure) => Set(configure, "span_field_masking"); public SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public SpanQueryDescriptor SpanFirst(Action> configure) => Set(configure, "span_first"); public SpanQueryDescriptor SpanGap(KeyValuePair integer) => Set(integer, "span_gap"); @@ -319,10 +319,10 @@ private SpanQueryDescriptor Set(object variant, string variantName) return Self; } - public SpanQueryDescriptor FieldMaskingSpan(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "field_masking_span"); - public SpanQueryDescriptor FieldMaskingSpan(Action configure) => Set(configure, "field_masking_span"); public SpanQueryDescriptor SpanContaining(Elastic.Clients.Elasticsearch.QueryDsl.SpanContainingQuery spanContainingQuery) => Set(spanContainingQuery, "span_containing"); public SpanQueryDescriptor SpanContaining(Action configure) => Set(configure, "span_containing"); + public SpanQueryDescriptor SpanFieldMasking(Elastic.Clients.Elasticsearch.QueryDsl.SpanFieldMaskingQuery spanFieldMaskingQuery) => Set(spanFieldMaskingQuery, "span_field_masking"); + public SpanQueryDescriptor SpanFieldMasking(Action configure) => Set(configure, "span_field_masking"); public SpanQueryDescriptor SpanFirst(Elastic.Clients.Elasticsearch.QueryDsl.SpanFirstQuery spanFirstQuery) => Set(spanFirstQuery, "span_first"); public SpanQueryDescriptor SpanFirst(Action configure) => Set(configure, "span_first"); public SpanQueryDescriptor SpanGap(KeyValuePair integer) => Set(integer, "span_gap");