diff --git a/.editorconfig b/.editorconfig index aca7adeb78d..a391533f562 100644 --- a/.editorconfig +++ b/.editorconfig @@ -201,7 +201,6 @@ resharper_redundant_case_label_highlighting=do_not_show resharper_redundant_argument_default_value_highlighting=do_not_show spelling_languages=en-us,en-gb -spelling_exclusion_path=.\exclusion.dic [Jenkinsfile] indent_style = space diff --git a/exclusion.dic b/exclusion.dic index b0f6a8c0dbc..e23d23be80b 100644 --- a/exclusion.dic +++ b/exclusion.dic @@ -4,4 +4,5 @@ async inferrer elasticsearch asciidocs -yyyy \ No newline at end of file +yyyy +enum \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/Core/IComplexUnion.cs b/src/Elastic.Clients.Elasticsearch/Core/IComplexUnion.cs new file mode 100644 index 00000000000..5f8e77b8826 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/Core/IComplexUnion.cs @@ -0,0 +1,13 @@ +// 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. + +using System; + +namespace Elastic.Clients.Elasticsearch.Core; + +internal interface IComplexUnion where TEnum : Enum +{ + internal TEnum ValueKind { get; } + internal object Value { get; } +} diff --git a/src/Elastic.Clients.Elasticsearch/Serialization/MultiItemUnionConverter.cs b/src/Elastic.Clients.Elasticsearch/Serialization/MultiItemUnionConverter.cs new file mode 100644 index 00000000000..b98a48f6f6d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/Serialization/MultiItemUnionConverter.cs @@ -0,0 +1,135 @@ +// 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. + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Elastic.Clients.Elasticsearch.Core; + +namespace Elastic.Clients.Elasticsearch.Serialization; + +/// +/// A base converter for any multi-item (>2 items) unions. The code-generator creates a +/// derived type which populates the fields in its constructor. +/// IMPORTANT: This is a MVP implementation which meets the requirements for the currently +/// generated multi-item unions. Additional logic may be needed when we first encounter +/// other item types. In the interests of time, we are not covering all cases for now. +/// +internal abstract class MultiItemUnionConverter : JsonConverter + where TUnion : IComplexUnion + where TEnum : Enum +{ + // Used when serializing to specify the type for each enum kind. + protected Dictionary _types; + + // Used when creating an instance of the TUnion for a specific type. + protected Dictionary> _factories; + + // Used when deserializing objects, to determine which type we have. + protected Dictionary _uniquePropertyToType; + + protected Type _arrayType; // For now, we handle only unions with one item being defined as an array + + public override TUnion? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + const string exceptionMessage = "Unable to match JSON object to union item."; + + // Plan of attack!! + // - If the token is start object: + // - For types which are objects, we need to identify required properties + // - Determine if each object has a unique required property (if not we need to find unique combinations) + // - If none are unique, we may struggle, but we can also check for unique optional properties + // - If the token is a literal value, see if we have a matching literal available + // - If the token is the start of an array, do we have an array type identified (we currently only support one array-based item). + + if (_factories is null) + ThrowHelper.ThrowJsonException("No factories have been registered for deserialization."); + + // We'll be handling an object + if (reader.TokenType == JsonTokenType.StartObject) + { + var readerCopy = reader; // We need a copy to use when reading ahead + + if (_uniquePropertyToType is null) + ThrowHelper.ThrowJsonException(exceptionMessage); + + using var jsonDoc = JsonDocument.ParseValue(ref readerCopy); + + if (jsonDoc is null) + ThrowHelper.ThrowJsonException(exceptionMessage); + + Type? matchedType = null; + + // Loop through the unique properties of each possible object. + // Once we find a match we can stop checking any further. + foreach (var item in _uniquePropertyToType) + { + if (jsonDoc.RootElement.TryGetProperty(item.Key, out _)) + { + // We've matched a unique property in the JSON object, so now know the type + matchedType = item.Value; + break; + } + } + + if (matchedType is null) + ThrowHelper.ThrowJsonException(exceptionMessage); + + if (!_factories.TryGetValue(matchedType, out var factory)) + ThrowHelper.ThrowJsonException("Unable to locate factory for multi-item union object item."); + + // Since we now know the type and have the factory for that type, we can deserialize the object + // and pass it to the factory to create the instance. + + var value = JsonSerializer.Deserialize(ref reader, matchedType, options); + + return factory.Invoke(value); + } + + if (reader.TokenType == JsonTokenType.String) + { + var value = reader.GetString(); + reader.Read(); + + if (!_factories.TryGetValue(typeof(string), out var factory)) + ThrowHelper.ThrowJsonException("Unable to locate factory for multi-item union accepting a string value."); + + return factory.Invoke(value); + } + + if (reader.TokenType == JsonTokenType.StartArray) + { + if (_arrayType is null) + ThrowHelper.ThrowJsonException(exceptionMessage); + + if (!_factories.TryGetValue(_arrayType, out var factory)) + ThrowHelper.ThrowJsonException("Unable to locate factory for multi-item union accepting an array value."); + + var value = JsonSerializer.Deserialize(ref reader, _arrayType, options); + + return factory.Invoke(value); + } + + ThrowHelper.ThrowJsonException($"Unable to deserialize JSON representing {typeof(TUnion)}."); + + return default; // We never reach here! + } + + public override void Write(Utf8JsonWriter writer, TUnion value, JsonSerializerOptions options) + { + if (_types is null) + ThrowHelper.ThrowJsonException("No types have been registered for serialization."); + + if (value is null) + { + writer.WriteNullValue(); + return; + } + + var serializeAsType = _types[value.ValueKind]; + + JsonSerializer.Serialize(writer, value.Value, serializeAsType, options); + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/AggregateOrderConverter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/AggregateOrderConverter.g.cs index 0da0eb910bb..18d4add021d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/AggregateOrderConverter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/AggregateOrderConverter.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs index 3da8891bdba..260b2a2de60 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/AggregateDictionary.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs index 23a912db19a..3f714ae8128 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Buckets.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs index f08022043b5..d1fa7b1033e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/FieldDateMath.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs index 4ad9a704d3c..45c152b2e66 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/Percentiles.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs index 2449e74bc30..e7a3618764c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ByteSize.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/CoordsGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CoordsGeoBounds.g.cs new file mode 100644 index 00000000000..2635aacb1a4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/CoordsGeoBounds.g.cs @@ -0,0 +1,95 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +public sealed partial class CoordsGeoBounds +{ + [JsonInclude, JsonPropertyName("bottom")] + public double Bottom { get; set; } + + [JsonInclude, JsonPropertyName("left")] + public double Left { get; set; } + + [JsonInclude, JsonPropertyName("right")] + public double Right { get; set; } + + [JsonInclude, JsonPropertyName("top")] + public double Top { get; set; } +} + +public sealed partial class CoordsGeoBoundsDescriptor : SerializableDescriptor +{ + internal CoordsGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + public CoordsGeoBoundsDescriptor() : base() + { + } + + private double BottomValue { get; set; } + + private double LeftValue { get; set; } + + private double RightValue { get; set; } + + private double TopValue { get; set; } + + public CoordsGeoBoundsDescriptor Bottom(double bottom) + { + BottomValue = bottom; + return Self; + } + + public CoordsGeoBoundsDescriptor Left(double left) + { + LeftValue = left; + return Self; + } + + public CoordsGeoBoundsDescriptor Right(double right) + { + RightValue = right; + return Self; + } + + public CoordsGeoBoundsDescriptor Top(double top) + { + TopValue = top; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("bottom"); + writer.WriteNumberValue(BottomValue); + writer.WritePropertyName("left"); + writer.WriteNumberValue(LeftValue); + writer.WritePropertyName("right"); + writer.WriteNumberValue(RightValue); + writer.WritePropertyName("top"); + writer.WriteNumberValue(TopValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Context.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Context.g.cs new file mode 100644 index 00000000000..d8e25ee3b5b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Context.g.cs @@ -0,0 +1,39 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Core.Search; +public sealed partial class Context : Union +{ + public Context(string category) : base(category) + { + } + + public Context(Elastic.Clients.Elasticsearch.GeoLocation location) : base(location) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs index 29b8ef12e1f..81a25e1cc35 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiGetResponseItem.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs index 11dd29fd111..45ea95a39a9 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/MultiSearchResponseItem.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs index 044efb03021..0f0b4f7465a 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/Search/CompletionContext.g.cs @@ -30,6 +30,9 @@ public sealed partial class CompletionContext [JsonInclude, JsonPropertyName("boost")] public double? Boost { get; set; } + [JsonInclude, JsonPropertyName("context")] + public Elastic.Clients.Elasticsearch.Core.Search.Context Context { get; set; } + [JsonInclude, JsonPropertyName("neighbours")] public ICollection? Neighbours { get; set; } @@ -49,6 +52,8 @@ public CompletionContextDescriptor() : base() private double? BoostValue { get; set; } + private Elastic.Clients.Elasticsearch.Core.Search.Context ContextValue { get; set; } + private ICollection? NeighboursValue { get; set; } private Elastic.Clients.Elasticsearch.GeoHashPrecision? PrecisionValue { get; set; } @@ -61,6 +66,12 @@ public CompletionContextDescriptor Boost(double? boost) return Self; } + public CompletionContextDescriptor Context(Elastic.Clients.Elasticsearch.Core.Search.Context context) + { + ContextValue = context; + return Self; + } + public CompletionContextDescriptor Neighbours(ICollection? neighbours) { NeighboursValue = neighbours; @@ -88,6 +99,8 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o writer.WriteNumberValue(BoostValue.Value); } + writer.WritePropertyName("context"); + JsonSerializer.Serialize(writer, ContextValue, options); if (NeighboursValue is not null) { writer.WritePropertyName("neighbours"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs index e400945a9e1..bee02e2fd55 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfig.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs index c554c8e6c19..8665473895d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/SourceConfigParam.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs index 945dd2e8c4c..a00b45f46ee 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Core/TrackHits.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs index 14341b2445a..8120e782e9d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.QueryDsl.g.cs @@ -409,6 +409,55 @@ public override void Write(Utf8JsonWriter writer, FunctionScoreMode value, JsonS } } +[JsonConverter(typeof(GeoValidationMethodConverter))] +public enum GeoValidationMethod +{ + [EnumMember(Value = "strict")] + Strict, + [EnumMember(Value = "ignore_malformed")] + IgnoreMalformed, + [EnumMember(Value = "coerce")] + Coerce +} + +internal sealed class GeoValidationMethodConverter : JsonConverter +{ + public override GeoValidationMethod Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "strict": + return GeoValidationMethod.Strict; + case "ignore_malformed": + return GeoValidationMethod.IgnoreMalformed; + case "coerce": + return GeoValidationMethod.Coerce; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, GeoValidationMethod value, JsonSerializerOptions options) + { + switch (value) + { + case GeoValidationMethod.Strict: + writer.WriteStringValue("strict"); + return; + case GeoValidationMethod.IgnoreMalformed: + writer.WriteStringValue("ignore_malformed"); + return; + case GeoValidationMethod.Coerce: + writer.WriteStringValue("coerce"); + return; + } + + writer.WriteNullValue(); + } +} + [JsonConverter(typeof(OperatorConverter))] public enum Operator { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ExpandWildcardsConverter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ExpandWildcardsConverter.g.cs index 54e28e97718..d02b16dcbea 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/ExpandWildcardsConverter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/ExpandWildcardsConverter.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FeaturesConverter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FeaturesConverter.g.cs index 3bee1cca8ae..b1b51af1e0c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/FeaturesConverter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/FeaturesConverter.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs index 23786deaea9..0c5841809a5 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Fuzziness.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoBounds.g.cs new file mode 100644 index 00000000000..b9e8f80bcd8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoBounds.g.cs @@ -0,0 +1,176 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Core; +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +[JsonConverter(typeof(GeoBoundsConverter))] +public sealed partial class GeoBounds : IComplexUnion +{ + public enum Kind + { + Coordinates, + TopLeftBottomRight, + TopRightBottomLeft, + Wkt + } + + private readonly Kind _kind; + private readonly object _value; + Kind IComplexUnion.ValueKind => _kind; + object IComplexUnion.Value => _value; + private GeoBounds(Kind kind, object value) + { + _kind = kind; + _value = value; + } + + public static GeoBounds Coordinates(Elastic.Clients.Elasticsearch.CoordsGeoBounds coordinates) => new(Kind.Coordinates, coordinates); + public bool IsCoordinates => _kind == Kind.Coordinates; + public bool TryGetCoordinates([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.CoordsGeoBounds? coordinates) + { + coordinates = null; + if (_kind == Kind.Coordinates) + { + coordinates = (Elastic.Clients.Elasticsearch.CoordsGeoBounds)_value; + return true; + } + + return false; + } + + public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.CoordsGeoBounds coordinates) => GeoBounds.Coordinates(coordinates); + public static GeoBounds TopLeftBottomRight(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds topLeftBottomRight) => new(Kind.TopLeftBottomRight, topLeftBottomRight); + public bool IsTopLeftBottomRight => _kind == Kind.TopLeftBottomRight; + public bool TryGetTopLeftBottomRight([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds? topLeftBottomRight) + { + topLeftBottomRight = null; + if (_kind == Kind.TopLeftBottomRight) + { + topLeftBottomRight = (Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds)_value; + return true; + } + + return false; + } + + public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds topLeftBottomRight) => GeoBounds.TopLeftBottomRight(topLeftBottomRight); + public static GeoBounds TopRightBottomLeft(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds topRightBottomLeft) => new(Kind.TopRightBottomLeft, topRightBottomLeft); + public bool IsTopRightBottomLeft => _kind == Kind.TopRightBottomLeft; + public bool TryGetTopRightBottomLeft([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds? topRightBottomLeft) + { + topRightBottomLeft = null; + if (_kind == Kind.TopRightBottomLeft) + { + topRightBottomLeft = (Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds)_value; + return true; + } + + return false; + } + + public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds topRightBottomLeft) => GeoBounds.TopRightBottomLeft(topRightBottomLeft); + public static GeoBounds Wkt(Elastic.Clients.Elasticsearch.WktGeoBounds wkt) => new(Kind.Wkt, wkt); + public bool IsWkt => _kind == Kind.Wkt; + public bool TryGetWkt([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.WktGeoBounds? wkt) + { + wkt = null; + if (_kind == Kind.Wkt) + { + wkt = (Elastic.Clients.Elasticsearch.WktGeoBounds)_value; + return true; + } + + return false; + } + + public static implicit operator GeoBounds(Elastic.Clients.Elasticsearch.WktGeoBounds wkt) => GeoBounds.Wkt(wkt); +} + +internal sealed class GeoBoundsConverter : MultiItemUnionConverter +{ + public GeoBoundsConverter() + { + _types = new Dictionary + { + { + GeoBounds.Kind.Coordinates, + typeof(Elastic.Clients.Elasticsearch.CoordsGeoBounds) + }, + { + GeoBounds.Kind.TopLeftBottomRight, + typeof(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds) + }, + { + GeoBounds.Kind.TopRightBottomLeft, + typeof(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds) + }, + { + GeoBounds.Kind.Wkt, + typeof(Elastic.Clients.Elasticsearch.WktGeoBounds) + } + }; + _factories = new Dictionary> + { + { + typeof(Elastic.Clients.Elasticsearch.CoordsGeoBounds), + o => GeoBounds.Coordinates((Elastic.Clients.Elasticsearch.CoordsGeoBounds)o) + }, + { + typeof(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds), + o => GeoBounds.TopLeftBottomRight((Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds)o) + }, + { + typeof(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds), + o => GeoBounds.TopRightBottomLeft((Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds)o) + }, + { + typeof(Elastic.Clients.Elasticsearch.WktGeoBounds), + o => GeoBounds.Wkt((Elastic.Clients.Elasticsearch.WktGeoBounds)o) + } + }; + _uniquePropertyToType = new Dictionary + { + { + "bottom", + typeof(Elastic.Clients.Elasticsearch.CoordsGeoBounds) + }, + { + "bottom_right", + typeof(Elastic.Clients.Elasticsearch.TopLeftBottomRightGeoBounds) + }, + { + "bottom_left", + typeof(Elastic.Clients.Elasticsearch.TopRightBottomLeftGeoBounds) + }, + { + "wkt", + typeof(Elastic.Clients.Elasticsearch.WktGeoBounds) + } + }; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashLocation.g.cs new file mode 100644 index 00000000000..4ed2dad1331 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashLocation.g.cs @@ -0,0 +1,56 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +public sealed partial class GeoHashLocation +{ + [JsonInclude, JsonPropertyName("geohash")] + public string Geohash { get; set; } +} + +public sealed partial class GeoHashLocationDescriptor : SerializableDescriptor +{ + internal GeoHashLocationDescriptor(Action configure) => configure.Invoke(this); + public GeoHashLocationDescriptor() : base() + { + } + + private string GeohashValue { get; set; } + + public GeoHashLocationDescriptor Geohash(string geohash) + { + GeohashValue = geohash; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("geohash"); + JsonSerializer.Serialize(writer, GeohashValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs index 4169a928e86..1e1c1761ab7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoHashPrecision.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLocation.g.cs new file mode 100644 index 00000000000..2b88fd281d6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/GeoLocation.g.cs @@ -0,0 +1,169 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Core; +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +[JsonConverter(typeof(GeoLocationConverter))] +public sealed partial class GeoLocation : IComplexUnion +{ + public enum Kind + { + LatitudeLongitude, + Geohash, + Coordinates, + Text + } + + private readonly Kind _kind; + private readonly object _value; + Kind IComplexUnion.ValueKind => _kind; + object IComplexUnion.Value => _value; + private GeoLocation(Kind kind, object value) + { + _kind = kind; + _value = value; + } + + public static GeoLocation LatitudeLongitude(Elastic.Clients.Elasticsearch.LatLonGeoLocation latitudeLongitude) => new(Kind.LatitudeLongitude, latitudeLongitude); + public bool IsLatitudeLongitude => _kind == Kind.LatitudeLongitude; + public bool TryGetLatitudeLongitude([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.LatLonGeoLocation? latitudeLongitude) + { + latitudeLongitude = null; + if (_kind == Kind.LatitudeLongitude) + { + latitudeLongitude = (Elastic.Clients.Elasticsearch.LatLonGeoLocation)_value; + return true; + } + + return false; + } + + public static implicit operator GeoLocation(Elastic.Clients.Elasticsearch.LatLonGeoLocation latitudeLongitude) => GeoLocation.LatitudeLongitude(latitudeLongitude); + public static GeoLocation Geohash(Elastic.Clients.Elasticsearch.GeoHashLocation geohash) => new(Kind.Geohash, geohash); + public bool IsGeohash => _kind == Kind.Geohash; + public bool TryGetGeohash([NotNullWhen(true)] out Elastic.Clients.Elasticsearch.GeoHashLocation? geohash) + { + geohash = null; + if (_kind == Kind.Geohash) + { + geohash = (Elastic.Clients.Elasticsearch.GeoHashLocation)_value; + return true; + } + + return false; + } + + public static implicit operator GeoLocation(Elastic.Clients.Elasticsearch.GeoHashLocation geohash) => GeoLocation.Geohash(geohash); + public static GeoLocation Coordinates(double[] coordinates) => new(Kind.Coordinates, coordinates); + public bool IsCoordinates => _kind == Kind.Coordinates; + public bool TryGetCoordinates([NotNullWhen(true)] out double[]? coordinates) + { + coordinates = null; + if (_kind == Kind.Coordinates) + { + coordinates = (double[])_value; + return true; + } + + return false; + } + + public static implicit operator GeoLocation(double[] coordinates) => GeoLocation.Coordinates(coordinates); + public static GeoLocation Text(string text) => new(Kind.Text, text); + public bool IsText => _kind == Kind.Text; + public bool TryGetText([NotNullWhen(true)] out string? text) + { + text = null; + if (_kind == Kind.Text) + { + text = (string)_value; + return true; + } + + return false; + } + + public static implicit operator GeoLocation(string text) => GeoLocation.Text(text); +} + +internal sealed class GeoLocationConverter : MultiItemUnionConverter +{ + public GeoLocationConverter() + { + _arrayType = typeof(double[]); + _types = new Dictionary + { + { + GeoLocation.Kind.LatitudeLongitude, + typeof(Elastic.Clients.Elasticsearch.LatLonGeoLocation) + }, + { + GeoLocation.Kind.Geohash, + typeof(Elastic.Clients.Elasticsearch.GeoHashLocation) + }, + { + GeoLocation.Kind.Coordinates, + typeof(double[]) + }, + { + GeoLocation.Kind.Text, + typeof(string) + } + }; + _factories = new Dictionary> + { + { + typeof(Elastic.Clients.Elasticsearch.LatLonGeoLocation), + o => GeoLocation.LatitudeLongitude((Elastic.Clients.Elasticsearch.LatLonGeoLocation)o) + }, + { + typeof(Elastic.Clients.Elasticsearch.GeoHashLocation), + o => GeoLocation.Geohash((Elastic.Clients.Elasticsearch.GeoHashLocation)o) + }, + { + typeof(double[]), + o => GeoLocation.Coordinates((double[])o) + }, + { + typeof(string), + o => GeoLocation.Text((string)o) + } + }; + _uniquePropertyToType = new Dictionary + { + { + "lat", + typeof(Elastic.Clients.Elasticsearch.LatLonGeoLocation) + }, + { + "geohash", + typeof(Elastic.Clients.Elasticsearch.GeoHashLocation) + } + }; + } +} diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/LatLonGeoLocation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LatLonGeoLocation.g.cs new file mode 100644 index 00000000000..497f1797f00 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/LatLonGeoLocation.g.cs @@ -0,0 +1,69 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +public sealed partial class LatLonGeoLocation +{ + [JsonInclude, JsonPropertyName("lat")] + public double Lat { get; set; } + + [JsonInclude, JsonPropertyName("lon")] + public double Lon { get; set; } +} + +public sealed partial class LatLonGeoLocationDescriptor : SerializableDescriptor +{ + internal LatLonGeoLocationDescriptor(Action configure) => configure.Invoke(this); + public LatLonGeoLocationDescriptor() : base() + { + } + + private double LatValue { get; set; } + + private double LonValue { get; set; } + + public LatLonGeoLocationDescriptor Lat(double lat) + { + LatValue = lat; + return Self; + } + + public LatLonGeoLocationDescriptor Lon(double lon) + { + LonValue = lon; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("lat"); + writer.WriteNumberValue(LatValue); + writer.WritePropertyName("lon"); + writer.WriteNumberValue(LonValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs index 41937272cc8..9556a9b093d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Mapping/GeoPointProperty.g.cs @@ -51,6 +51,9 @@ public sealed partial class GeoPointProperty : IProperty [JsonInclude, JsonPropertyName("meta")] public IDictionary? Meta { get; set; } + [JsonInclude, JsonPropertyName("null_value")] + public Elastic.Clients.Elasticsearch.GeoLocation? NullValue { get; set; } + [JsonInclude, JsonPropertyName("properties")] public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; } @@ -88,6 +91,8 @@ public GeoPointPropertyDescriptor() : base() private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.GeoLocation? NullValueValue { get; set; } + private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } private string? SimilarityValue { get; set; } @@ -156,6 +161,12 @@ public GeoPointPropertyDescriptor Meta(Func NullValue(Elastic.Clients.Elasticsearch.GeoLocation? nullValue) + { + NullValueValue = nullValue; + return Self; + } + public GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) { PropertiesValue = properties; @@ -239,6 +250,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, MetaValue, options); } + if (NullValueValue is not null) + { + writer.WritePropertyName("null_value"); + JsonSerializer.Serialize(writer, NullValueValue, options); + } + if (PropertiesValue is not null) { writer.WritePropertyName("properties"); @@ -272,6 +289,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o IgnoreMalformed = IgnoreMalformedValue, IgnoreZValue = IgnoreZValueValue, Meta = MetaValue, + NullValue = NullValueValue, Properties = PropertiesValue, Similarity = SimilarityValue, Store = StoreValue @@ -301,6 +319,8 @@ public GeoPointPropertyDescriptor() : base() private IDictionary? MetaValue { get; set; } + private Elastic.Clients.Elasticsearch.GeoLocation? NullValueValue { get; set; } + private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; } private string? SimilarityValue { get; set; } @@ -369,6 +389,12 @@ public GeoPointPropertyDescriptor Meta(Func, Fl return Self; } + public GeoPointPropertyDescriptor NullValue(Elastic.Clients.Elasticsearch.GeoLocation? nullValue) + { + NullValueValue = nullValue; + return Self; + } + public GeoPointPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties) { PropertiesValue = properties; @@ -452,6 +478,12 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, MetaValue, options); } + if (NullValueValue is not null) + { + writer.WritePropertyName("null_value"); + JsonSerializer.Serialize(writer, NullValueValue, options); + } + if (PropertiesValue is not null) { writer.WritePropertyName("properties"); @@ -485,6 +517,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o IgnoreMalformed = IgnoreMalformedValue, IgnoreZValue = IgnoreZValueValue, Meta = MetaValue, + NullValue = NullValueValue, Properties = PropertiesValue, Similarity = SimilarityValue, Store = StoreValue diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs new file mode 100644 index 00000000000..c1c1726ea16 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/GeoBoundingBoxQuery.g.cs @@ -0,0 +1,336 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.QueryDsl; +internal sealed partial class GeoBoundingBoxQueryConverter : JsonConverter +{ + public override GeoBoundingBoxQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new GeoBoundingBoxQuery(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "_name") + { + variant.QueryName = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "boost") + { + variant.Boost = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "ignore_unmapped") + { + variant.IgnoreUnmapped = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "validation_method") + { + variant.ValidationMethod = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + variant.Field = property; + reader.Read(); + variant.BoundingBox = JsonSerializer.Deserialize(ref reader, options); + } + } + + return variant; + } + + public override void Write(Utf8JsonWriter writer, GeoBoundingBoxQuery value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Field is not null && value.BoundingBox is not null) + { + if (!options.TryGetClientSettings(out var settings)) + { + ThrowHelper.ThrowJsonExceptionForMissingSettings(); + } + + var propertyName = settings.Inferrer.Field(value.Field); + writer.WritePropertyName(propertyName); + JsonSerializer.Serialize(writer, value.BoundingBox, options); + } + + if (!string.IsNullOrEmpty(value.QueryName)) + { + writer.WritePropertyName("_name"); + writer.WriteStringValue(value.QueryName); + } + + if (value.Boost.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(value.Boost.Value); + } + + if (value.IgnoreUnmapped.HasValue) + { + writer.WritePropertyName("ignore_unmapped"); + writer.WriteBooleanValue(value.IgnoreUnmapped.Value); + } + + if (value.ValidationMethod is not null) + { + writer.WritePropertyName("validation_method"); + JsonSerializer.Serialize(writer, value.ValidationMethod, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(GeoBoundingBoxQueryConverter))] +public sealed partial class GeoBoundingBoxQuery : SearchQuery +{ + public string? QueryName { get; set; } + + public float? Boost { get; set; } + + public Elastic.Clients.Elasticsearch.GeoBounds BoundingBox { get; set; } + + public Elastic.Clients.Elasticsearch.Field Field { get; set; } + + public bool? IgnoreUnmapped { get; set; } + + public Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethod { get; set; } + + public static implicit operator Query(GeoBoundingBoxQuery geoBoundingBoxQuery) => QueryDsl.Query.GeoBoundingBox(geoBoundingBoxQuery); +} + +public sealed partial class GeoBoundingBoxQueryDescriptor : SerializableDescriptor> +{ + internal GeoBoundingBoxQueryDescriptor(Action> configure) => configure.Invoke(this); + public GeoBoundingBoxQueryDescriptor() : base() + { + } + + private string? QueryNameValue { get; set; } + + private float? BoostValue { get; set; } + + private bool? IgnoreUnmappedValue { get; set; } + + private Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethodValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private Elastic.Clients.Elasticsearch.GeoBounds BoundingBoxValue { get; set; } + + public GeoBoundingBoxQueryDescriptor QueryName(string? queryName) + { + QueryNameValue = queryName; + return Self; + } + + public GeoBoundingBoxQueryDescriptor Boost(float? boost) + { + BoostValue = boost; + return Self; + } + + public GeoBoundingBoxQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + { + IgnoreUnmappedValue = ignoreUnmapped; + return Self; + } + + public GeoBoundingBoxQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? validationMethod) + { + ValidationMethodValue = validationMethod; + return Self; + } + + public GeoBoundingBoxQueryDescriptor BoundingBox(Elastic.Clients.Elasticsearch.GeoBounds boundingBox) + { + BoundingBoxValue = boundingBox; + return Self; + } + + public GeoBoundingBoxQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public GeoBoundingBoxQueryDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FieldValue is not null && BoundingBoxValue is not null) + { + var propertyName = settings.Inferrer.Field(FieldValue); + writer.WritePropertyName(propertyName); + JsonSerializer.Serialize(writer, BoundingBoxValue, options); + } + + if (!string.IsNullOrEmpty(QueryNameValue)) + { + writer.WritePropertyName("_name"); + writer.WriteStringValue(QueryNameValue); + } + + if (BoostValue.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(BoostValue.Value); + } + + if (IgnoreUnmappedValue.HasValue) + { + writer.WritePropertyName("ignore_unmapped"); + writer.WriteBooleanValue(IgnoreUnmappedValue.Value); + } + + if (ValidationMethodValue is not null) + { + writer.WritePropertyName("validation_method"); + JsonSerializer.Serialize(writer, ValidationMethodValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class GeoBoundingBoxQueryDescriptor : SerializableDescriptor +{ + internal GeoBoundingBoxQueryDescriptor(Action configure) => configure.Invoke(this); + public GeoBoundingBoxQueryDescriptor() : base() + { + } + + private string? QueryNameValue { get; set; } + + private float? BoostValue { get; set; } + + private bool? IgnoreUnmappedValue { get; set; } + + private Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? ValidationMethodValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private Elastic.Clients.Elasticsearch.GeoBounds BoundingBoxValue { get; set; } + + public GeoBoundingBoxQueryDescriptor QueryName(string? queryName) + { + QueryNameValue = queryName; + return Self; + } + + public GeoBoundingBoxQueryDescriptor Boost(float? boost) + { + BoostValue = boost; + return Self; + } + + public GeoBoundingBoxQueryDescriptor IgnoreUnmapped(bool? ignoreUnmapped = true) + { + IgnoreUnmappedValue = ignoreUnmapped; + return Self; + } + + public GeoBoundingBoxQueryDescriptor ValidationMethod(Elastic.Clients.Elasticsearch.QueryDsl.GeoValidationMethod? validationMethod) + { + ValidationMethodValue = validationMethod; + return Self; + } + + public GeoBoundingBoxQueryDescriptor BoundingBox(Elastic.Clients.Elasticsearch.GeoBounds boundingBox) + { + BoundingBoxValue = boundingBox; + return Self; + } + + public GeoBoundingBoxQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public GeoBoundingBoxQueryDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public GeoBoundingBoxQueryDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FieldValue is not null && BoundingBoxValue is not null) + { + var propertyName = settings.Inferrer.Field(FieldValue); + writer.WritePropertyName(propertyName); + JsonSerializer.Serialize(writer, BoundingBoxValue, options); + } + + if (!string.IsNullOrEmpty(QueryNameValue)) + { + writer.WritePropertyName("_name"); + writer.WriteStringValue(QueryNameValue); + } + + if (BoostValue.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(BoostValue.Value); + } + + if (IgnoreUnmappedValue.HasValue) + { + writer.WritePropertyName("ignore_unmapped"); + writer.WriteBooleanValue(IgnoreUnmappedValue.Value); + } + + if (ValidationMethodValue is not null) + { + writer.WritePropertyName("validation_method"); + JsonSerializer.Serialize(writer, ValidationMethodValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs index 6082c9ddf67..88fbb3ab976 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Like.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs index 2b56504afbf..1778dfe6ebf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/Query.g.cs @@ -53,6 +53,7 @@ internal Query(string variantName, object variant) 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); public static Query HasChild(Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery hasChildQuery) => new Query("has_child", hasChildQuery); public static Query HasParent(Elastic.Clients.Elasticsearch.QueryDsl.HasParentQuery hasParentQuery) => new Query("has_parent", hasParentQuery); public static Query Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => new Query("ids", idsQuery); @@ -171,6 +172,13 @@ public override Query Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe return new Query(propertyName, variant); } + if (propertyName == "geo_bounding_box") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + reader.Read(); + return new Query(propertyName, variant); + } + if (propertyName == "has_child") { var variant = JsonSerializer.Deserialize(ref reader, options); @@ -459,6 +467,9 @@ public override void Write(Utf8JsonWriter writer, Query value, JsonSerializerOpt case "fuzzy": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.FuzzyQuery)value.Variant, options); break; + case "geo_bounding_box": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.GeoBoundingBoxQuery)value.Variant, options); + break; case "has_child": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.HasChildQuery)value.Variant, options); break; @@ -625,6 +636,8 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor FunctionScore(Action> configure) => Set(configure, "function_score"); public QueryDescriptor Fuzzy(FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); public QueryDescriptor Fuzzy(Action> configure) => Set(configure, "fuzzy"); + public QueryDescriptor GeoBoundingBox(GeoBoundingBoxQuery geoBoundingBoxQuery) => Set(geoBoundingBoxQuery, "geo_bounding_box"); + public QueryDescriptor GeoBoundingBox(Action> configure) => Set(configure, "geo_bounding_box"); public QueryDescriptor HasChild(HasChildQuery hasChildQuery) => Set(hasChildQuery, "has_child"); public QueryDescriptor HasChild(Action> configure) => Set(configure, "has_child"); public QueryDescriptor HasParent(HasParentQuery hasParentQuery) => Set(hasParentQuery, "has_parent"); @@ -780,6 +793,9 @@ private QueryDescriptor Set(object variant, string variantName) public QueryDescriptor Fuzzy(FuzzyQuery fuzzyQuery) => Set(fuzzyQuery, "fuzzy"); public QueryDescriptor Fuzzy(Action configure) => Set(configure, "fuzzy"); public QueryDescriptor Fuzzy(Action> configure) => Set(configure, "fuzzy"); + public QueryDescriptor GeoBoundingBox(GeoBoundingBoxQuery geoBoundingBoxQuery) => Set(geoBoundingBoxQuery, "geo_bounding_box"); + public QueryDescriptor GeoBoundingBox(Action configure) => Set(configure, "geo_bounding_box"); + public QueryDescriptor GeoBoundingBox(Action> configure) => Set(configure, "geo_bounding_box"); public QueryDescriptor HasChild(HasChildQuery hasChildQuery) => Set(hasChildQuery, "has_child"); public QueryDescriptor HasChild(Action configure) => Set(configure, "has_child"); public QueryDescriptor HasChild(Action> configure) => Set(configure, "has_child"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs index a34210f437e..07622c9bd72 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQueryField.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs index 729efcc83d6..1c352b6881e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Script.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs index ed519737a6c..774920e9650 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Slices.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StopWordsConverter.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StopWordsConverter.g.cs index d0718176d34..f996c8e85eb 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/StopWordsConverter.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/StopWordsConverter.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs index 1d417ebd423..19e24b38f29 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Tasks/TaskInfos.g.cs @@ -20,6 +20,7 @@ using Elastic.Transport; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopLeftBottomRightGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopLeftBottomRightGeoBounds.g.cs new file mode 100644 index 00000000000..23f6825a7ea --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopLeftBottomRightGeoBounds.g.cs @@ -0,0 +1,69 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +public sealed partial class TopLeftBottomRightGeoBounds +{ + [JsonInclude, JsonPropertyName("bottom_right")] + public Elastic.Clients.Elasticsearch.GeoLocation BottomRight { get; set; } + + [JsonInclude, JsonPropertyName("top_left")] + public Elastic.Clients.Elasticsearch.GeoLocation TopLeft { get; set; } +} + +public sealed partial class TopLeftBottomRightGeoBoundsDescriptor : SerializableDescriptor +{ + internal TopLeftBottomRightGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + public TopLeftBottomRightGeoBoundsDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.GeoLocation BottomRightValue { get; set; } + + private Elastic.Clients.Elasticsearch.GeoLocation TopLeftValue { get; set; } + + public TopLeftBottomRightGeoBoundsDescriptor BottomRight(Elastic.Clients.Elasticsearch.GeoLocation bottomRight) + { + BottomRightValue = bottomRight; + return Self; + } + + public TopLeftBottomRightGeoBoundsDescriptor TopLeft(Elastic.Clients.Elasticsearch.GeoLocation topLeft) + { + TopLeftValue = topLeft; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("bottom_right"); + JsonSerializer.Serialize(writer, BottomRightValue, options); + writer.WritePropertyName("top_left"); + JsonSerializer.Serialize(writer, TopLeftValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopRightBottomLeftGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopRightBottomLeftGeoBounds.g.cs new file mode 100644 index 00000000000..b169d12949a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/TopRightBottomLeftGeoBounds.g.cs @@ -0,0 +1,69 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +public sealed partial class TopRightBottomLeftGeoBounds +{ + [JsonInclude, JsonPropertyName("bottom_left")] + public Elastic.Clients.Elasticsearch.GeoLocation BottomLeft { get; set; } + + [JsonInclude, JsonPropertyName("top_right")] + public Elastic.Clients.Elasticsearch.GeoLocation TopRight { get; set; } +} + +public sealed partial class TopRightBottomLeftGeoBoundsDescriptor : SerializableDescriptor +{ + internal TopRightBottomLeftGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + public TopRightBottomLeftGeoBoundsDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.GeoLocation BottomLeftValue { get; set; } + + private Elastic.Clients.Elasticsearch.GeoLocation TopRightValue { get; set; } + + public TopRightBottomLeftGeoBoundsDescriptor BottomLeft(Elastic.Clients.Elasticsearch.GeoLocation bottomLeft) + { + BottomLeftValue = bottomLeft; + return Self; + } + + public TopRightBottomLeftGeoBoundsDescriptor TopRight(Elastic.Clients.Elasticsearch.GeoLocation topRight) + { + TopRightValue = topRight; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("bottom_left"); + JsonSerializer.Serialize(writer, BottomLeftValue, options); + writer.WritePropertyName("top_right"); + JsonSerializer.Serialize(writer, TopRightValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/WktGeoBounds.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/WktGeoBounds.g.cs new file mode 100644 index 00000000000..039e1136ac8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/WktGeoBounds.g.cs @@ -0,0 +1,56 @@ +// 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. +// +// ------------------------------------------------ + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch; +public sealed partial class WktGeoBounds +{ + [JsonInclude, JsonPropertyName("wkt")] + public string Wkt { get; set; } +} + +public sealed partial class WktGeoBoundsDescriptor : SerializableDescriptor +{ + internal WktGeoBoundsDescriptor(Action configure) => configure.Invoke(this); + public WktGeoBoundsDescriptor() : base() + { + } + + private string WktValue { get; set; } + + public WktGeoBoundsDescriptor Wkt(string wkt) + { + WktValue = wkt; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("wkt"); + writer.WriteStringValue(WktValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Playground/Program.cs b/src/Playground/Program.cs index b7aa873b210..32e08c97152 100644 --- a/src/Playground/Program.cs +++ b/src/Playground/Program.cs @@ -5,6 +5,7 @@ using Elastic.Clients.Elasticsearch; using Elastic.Clients.Elasticsearch.Aggregations; using Elastic.Clients.Elasticsearch.IndexManagement; +using Elastic.Clients.Elasticsearch.Mapping; using Elastic.Transport; using Moq; using Playground; @@ -46,6 +47,28 @@ var client = new ElasticsearchClient(settings); +var myTemplate = new DynamicTemplate +{ + PathMatch = "testPathMatch", + Mapping = new KeywordProperty() +}; + +var createIndexRequest = new CreateIndexRequest("testing") +{ + Mappings = new TypeMapping + { + DynamicTemplates = new[] + { + new Dictionary + { + { "testTemplateName", myTemplate } + } + } + } +}; + +var indexCreateResponse = await client.Indices.CreateAsync(createIndexRequest); + var createIndexResponse = await client.Indices.CreateAsync("my-index-name", i => i .Mappings(m => m.Properties(p => p .Boolean(p => p.IsDeleted, b => b.NullValue(true).Store(false).Fielddata(f => f.Format(NumericFielddataFormat.Array))) diff --git a/tests/Tests.Domain/Project.cs b/tests/Tests.Domain/Project.cs index 7c313216c39..d59d17c1511 100644 --- a/tests/Tests.Domain/Project.cs +++ b/tests/Tests.Domain/Project.cs @@ -40,7 +40,7 @@ public class Project public Developer LeadDeveloper { get; set; } - //public GeoPoint LocationPoint { get; set; } // Was SimpleGeoPoint + public SimpleGeoPoint LocationPoint { get; set; } //public IGeoShape LocationShape { get; set; } //public IGeoShape ArbitraryShape { get; set; } @@ -88,7 +88,7 @@ public class Project .RuleFor(p => p.LeadDeveloper, p => Developer.Developers[Gimme.Random.Number(0, Developer.Developers.Count - 1)]) .RuleFor(p => p.Tags, f => Tag.Generator.Generate(Gimme.Random.Number(2, 10))) .RuleFor(p => p.CuratedTags, f => Tag.Generator.Generate(Gimme.Random.Number(1, 5))) - //.RuleFor(p => p.LocationPoint, f => SimpleGeoPoint.Generator.Generate()) + .RuleFor(p => p.LocationPoint, f => SimpleGeoPoint.Generator.Generate()) //.RuleFor(p => p.LocationShape, f => new PointGeoShape(new GeoCoordinate(f.Address.Latitude(), f.Address.Latitude()))) //.RuleFor(p => p.ArbitraryShape, f => new PointGeoShape(new GeoCoordinate(f.Address.Latitude(), f.Address.Latitude()))) .RuleFor(p => p.NumberOfCommits, f => Gimme.Random.Number(1, 1000)) diff --git a/tests/Tests.Domain/SimpleGeoPoint.cs b/tests/Tests.Domain/SimpleGeoPoint.cs new file mode 100644 index 00000000000..19667954561 --- /dev/null +++ b/tests/Tests.Domain/SimpleGeoPoint.cs @@ -0,0 +1,21 @@ +// 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. + +using Bogus; +using Tests.Configuration; + +namespace Tests.Domain; + +public class SimpleGeoPoint +{ + public static Faker Generator { get; } = + new Faker() + .UseSeed(TestConfiguration.Instance.Seed) + .RuleFor(p => p.Lat, f => f.Address.Latitude()) + .RuleFor(p => p.Lon, f => f.Address.Longitude()) + .Clone(); + + public double Lat { get; set; } + public double Lon { get; set; } +} diff --git a/tests/Tests/QueryDsl/Geo/GeoBoundingBoxQueryUsageTests.cs b/tests/Tests/QueryDsl/Geo/GeoBoundingBoxQueryUsageTests.cs new file mode 100644 index 00000000000..46df021b355 --- /dev/null +++ b/tests/Tests/QueryDsl/Geo/GeoBoundingBoxQueryUsageTests.cs @@ -0,0 +1,43 @@ +// 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. + +using Elastic.Clients.Elasticsearch.QueryDsl; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Framework.EndpointTests.TestState; + +namespace Tests.QueryDsl.Geo; + +public class GeoBoundingBoxQueryUsageTests : QueryDslUsageTestsBase +{ + public GeoBoundingBoxQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { } + + protected override Query QueryInitializer => new GeoBoundingBoxQuery + { + Boost = 1.1f, + QueryName = "named_query", + Field = Infer.Field(p => p.LocationPoint), + BoundingBox = new TopLeftBottomRightGeoBounds + { + TopLeft = new LatLonGeoLocation { Lat = 34.0, Lon = -34 }, + BottomRight = new LatLonGeoLocation { Lat = -34.0, Lon = 34 } + }, + ValidationMethod = GeoValidationMethod.Strict, + IgnoreUnmapped = true + }; + + protected override QueryDescriptor QueryFluent(QueryDescriptor queryDescriptor) => queryDescriptor + .GeoBoundingBox(g => g + .Boost(1.1f) + .QueryName("named_query") + .Field(p => p.LocationPoint) + .BoundingBox(new TopLeftBottomRightGeoBounds + { + TopLeft = new LatLonGeoLocation { Lat = 34.0, Lon = -34 }, + BottomRight = new LatLonGeoLocation { Lat = -34.0, Lon = 34 } + }) + .ValidationMethod(GeoValidationMethod.Strict) + .IgnoreUnmapped(true) + ); +} diff --git a/tests/Tests/QueryDsl/QueryDslUsageTestsBase.cs b/tests/Tests/QueryDsl/QueryDslUsageTestsBase.cs new file mode 100644 index 00000000000..6f763f26142 --- /dev/null +++ b/tests/Tests/QueryDsl/QueryDslUsageTestsBase.cs @@ -0,0 +1,51 @@ +// 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. + +using System; +using System.Threading.Tasks; +using Elastic.Clients.Elasticsearch.QueryDsl; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Framework.EndpointTests; +using Tests.Framework.EndpointTests.TestState; +using Tests.Core.Extensions; + +namespace Tests.QueryDsl; + +public abstract class QueryDslUsageTestsBase : ApiTestBase, SearchRequestDescriptor, SearchRequest> +{ + protected QueryDslUsageTestsBase(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override bool VerifyJson => true; + + protected override Action> Fluent => s => s + .Query(q => QueryFluent(q)); + + protected override HttpMethod ExpectHttpMethod => HttpMethod.POST; + + protected override SearchRequest Initializer => + new() + { + Query = QueryInitializer + }; + + protected abstract Query QueryInitializer { get; } + + protected override string ExpectedUrlPathAndQuery => "/project/_search"; + + protected override LazyResponses ClientUsage() => Calls( + (client, f) => client.Search(f), + (client, f) => client.SearchAsync(f), + (client, r) => client.Search(r), + (client, r) => client.SearchAsync(r) + ); + + protected abstract QueryDescriptor QueryFluent(QueryDescriptor queryDescriptor); + + [I] + protected async Task AssertQueryResponse() => await AssertOnAllResponses(r => + { + r.ShouldBeValid(); + }); +} diff --git a/tests/Tests/Types/GeoBoundsSerializationTests.cs b/tests/Tests/Types/GeoBoundsSerializationTests.cs new file mode 100644 index 00000000000..d58058ed321 --- /dev/null +++ b/tests/Tests/Types/GeoBoundsSerializationTests.cs @@ -0,0 +1,86 @@ +// 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. + +using System.Threading.Tasks; +using Tests.Serialization; +using VerifyXunit; + +namespace Tests.Types; + +[UsesVerify] +public class GeoBoundsSerializationTests : SerializerTestBase +{ + [U] + public async Task RoundTripSerialize_GeoBounds_WithCoordsGeoBounds() + { + var geoBounds = GeoBounds.Coordinates(new CoordsGeoBounds { Top = 40.73, Left = -74.1, Bottom = 40.01, Right = -71.12 }); + + var result = await RoundTripAndVerifyJsonAsync(geoBounds); + + result.TryGetCoordinates(out var coordinates).Should().BeTrue(); + + coordinates.Top.Should().Be(40.73); + coordinates.Left.Should().Be(-74.1); + coordinates.Bottom.Should().Be(40.01); + coordinates.Right.Should().Be(-71.12); + } + + [U] + public async Task RoundTripSerialize_GeoBounds_WithWktGeoBounds() + { + const string wktData = "BBOX (-74.1, -71.12, 40.73, 40.01)"; + + var geoBounds = GeoBounds.Wkt(new WktGeoBounds { Wkt = wktData }); + + var result = await RoundTripAndVerifyJsonAsync(geoBounds); + + result.TryGetWkt(out var wkt).Should().BeTrue(); + + wkt.Wkt.Should().Be(wktData); + } + + [U] + public async Task RoundTripSerialize_GeoBounds_WithTrbl() + { + var geoBounds = GeoBounds.TopRightBottomLeft(new TopRightBottomLeftGeoBounds + { + TopRight = GeoLocation.LatitudeLongitude(new LatLonGeoLocation() { Lat = 10, Lon = 20 }), + BottomLeft = GeoLocation.LatitudeLongitude(new LatLonGeoLocation() { Lat = 30, Lon = 40 }) + }); + + var result = await RoundTripAndVerifyJsonAsync(geoBounds); + + result.TryGetTopRightBottomLeft(out var trbl).Should().BeTrue(); + + trbl.TopRight.TryGetLatitudeLongitude(out var trLatLon).Should().BeTrue(); + trbl.BottomLeft.TryGetLatitudeLongitude(out var blLatLon).Should().BeTrue(); + + trLatLon.Lat.Should().Be(10); + trLatLon.Lon.Should().Be(20); + blLatLon.Lat.Should().Be(30); + blLatLon.Lon.Should().Be(40); + } + + [U] + public async Task RoundTripSerialize_GeoBounds_WithTlbr() + { + var geoBounds = GeoBounds.TopLeftBottomRight(new TopLeftBottomRightGeoBounds + { + TopLeft = GeoLocation.LatitudeLongitude(new LatLonGeoLocation() { Lat = 10, Lon = 20 }), + BottomRight = GeoLocation.LatitudeLongitude(new LatLonGeoLocation() { Lat = 30, Lon = 40 }) + }); + + var result = await RoundTripAndVerifyJsonAsync(geoBounds); + + result.TryGetTopLeftBottomRight(out var tlbr).Should().BeTrue(); + + tlbr.TopLeft.TryGetLatitudeLongitude(out var tlLatLon).Should().BeTrue(); + tlbr.BottomRight.TryGetLatitudeLongitude(out var brLatLon).Should().BeTrue(); + + tlLatLon.Lat.Should().Be(10); + tlLatLon.Lon.Should().Be(20); + brLatLon.Lat.Should().Be(30); + brLatLon.Lon.Should().Be(40); + } +} diff --git a/tests/Tests/Types/GeoLocationSerializationTests.cs b/tests/Tests/Types/GeoLocationSerializationTests.cs new file mode 100644 index 00000000000..0e3b6722379 --- /dev/null +++ b/tests/Tests/Types/GeoLocationSerializationTests.cs @@ -0,0 +1,68 @@ +// 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. + +using System.Threading.Tasks; +using Tests.Serialization; +using VerifyXunit; + +namespace Tests.Types; + +[UsesVerify] +public class GeoLocationSerializationTests : SerializerTestBase +{ + [U] + public async Task RoundTripSerialize_GeoLocation_WithText() + { + const string textValue = "text-value"; + + var geoLocation = GeoLocation.Text(textValue); + + var result = await RoundTripAndVerifyJsonAsync(geoLocation); + + result.TryGetText(out var text).Should().BeTrue(); + + text.Should().Be(textValue); + } + + [U] + public async Task RoundTripSerialize_GeoLocation_WithLatLonGeoLocation() + { + var geoLocation = GeoLocation.LatitudeLongitude(new() { Lat = 55.5, Lon = -77.7 }); + + var result = await RoundTripAndVerifyJsonAsync(geoLocation); + + result.TryGetLatitudeLongitude(out var latLon).Should().BeTrue(); + + latLon.Lat.Should().Be(55.5); + latLon.Lon.Should().Be(-77.7); + } + + [U] + public async Task RoundTripSerialize_GeoLocation_WithGeoHashLocation() + { + const string hash = "dr5r9ydj2y73"; + + var geoLocation = GeoLocation.Geohash(new() { Geohash = hash }); + + var result = await RoundTripAndVerifyJsonAsync(geoLocation); + + result.TryGetGeohash(out var geoHash).Should().BeTrue(); + + geoHash.Geohash.Should().Be(hash); + } + + [U] + public async Task RoundTripSerialize_GeoLocation_WithCoordinates() + { + var coordinates = new double[] { -74.1, 40.73 }; + + var geoLocation = GeoLocation.Coordinates(coordinates); + + var result = await RoundTripAndVerifyJsonAsync(geoLocation); + + result.TryGetCoordinates(out var coords).Should().BeTrue(); + + coords.Should().BeEquivalentTo(coordinates); + } +} diff --git a/tests/Tests/_VerifySnapshots/GeoBoundingBoxQueryUsageTests.VerifyDescriptorJson.verified.txt b/tests/Tests/_VerifySnapshots/GeoBoundingBoxQueryUsageTests.VerifyDescriptorJson.verified.txt new file mode 100644 index 00000000000..1ec192548ff --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoBoundingBoxQueryUsageTests.VerifyDescriptorJson.verified.txt @@ -0,0 +1,20 @@ +{ + query: { + geo_bounding_box: { + boost: 1.1, + ignore_unmapped: true, + locationPoint: { + bottom_right: { + lat: -34, + lon: 34 + }, + top_left: { + lat: 34, + lon: -34 + } + }, + validation_method: strict, + _name: named_query + } + } +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoBoundingBoxQueryUsageTests.VerifyInitializerJson.verified.txt b/tests/Tests/_VerifySnapshots/GeoBoundingBoxQueryUsageTests.VerifyInitializerJson.verified.txt new file mode 100644 index 00000000000..1ec192548ff --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoBoundingBoxQueryUsageTests.VerifyInitializerJson.verified.txt @@ -0,0 +1,20 @@ +{ + query: { + geo_bounding_box: { + boost: 1.1, + ignore_unmapped: true, + locationPoint: { + bottom_right: { + lat: -34, + lon: 34 + }, + top_left: { + lat: 34, + lon: -34 + } + }, + validation_method: strict, + _name: named_query + } + } +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithCoordsGeoBounds.verified.txt b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithCoordsGeoBounds.verified.txt new file mode 100644 index 00000000000..fbb565ae6ab --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithCoordsGeoBounds.verified.txt @@ -0,0 +1,6 @@ +{ + bottom: 40.01, + left: -74.1, + right: -71.12, + top: 40.73 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithTlbr.verified.txt b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithTlbr.verified.txt new file mode 100644 index 00000000000..9cfc37dfba7 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithTlbr.verified.txt @@ -0,0 +1,10 @@ +{ + bottom_right: { + lat: 30, + lon: 40 + }, + top_left: { + lat: 10, + lon: 20 + } +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithTrbl.verified.txt b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithTrbl.verified.txt new file mode 100644 index 00000000000..f8fed5427fc --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithTrbl.verified.txt @@ -0,0 +1,10 @@ +{ + bottom_left: { + lat: 30, + lon: 40 + }, + top_right: { + lat: 10, + lon: 20 + } +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithWktGeoBounds.verified.txt b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithWktGeoBounds.verified.txt new file mode 100644 index 00000000000..ccb92d1a427 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.RoundTripSerialize_GeoBounds_WithWktGeoBounds.verified.txt @@ -0,0 +1,3 @@ +{ + wkt: BBOX (-74.1, -71.12, 40.73, 40.01) +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.Serialize_GeoBounds_WithCoordsGeoBounds.verified.txt b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.Serialize_GeoBounds_WithCoordsGeoBounds.verified.txt new file mode 100644 index 00000000000..fbb565ae6ab --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoBoundsSerializationTests.Serialize_GeoBounds_WithCoordsGeoBounds.verified.txt @@ -0,0 +1,6 @@ +{ + bottom: 40.01, + left: -74.1, + right: -71.12, + top: 40.73 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithCoordinates.verified.txt b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithCoordinates.verified.txt new file mode 100644 index 00000000000..8f4509982e3 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithCoordinates.verified.txt @@ -0,0 +1,4 @@ +[ + -74.1, + 40.73 +] \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithGeoHashLocation.verified.txt b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithGeoHashLocation.verified.txt new file mode 100644 index 00000000000..deeb5034e5f --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithGeoHashLocation.verified.txt @@ -0,0 +1,3 @@ +{ + geohash: dr5r9ydj2y73 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithLatLonGeoLocation.verified.txt b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithLatLonGeoLocation.verified.txt new file mode 100644 index 00000000000..100a300ba67 --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithLatLonGeoLocation.verified.txt @@ -0,0 +1,4 @@ +{ + lat: 55.5, + lon: -77.7 +} \ No newline at end of file diff --git a/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithText.verified.txt b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithText.verified.txt new file mode 100644 index 00000000000..3adf2e59a8c --- /dev/null +++ b/tests/Tests/_VerifySnapshots/GeoLocationSerializationTests.RoundTripSerialize_GeoLocation_WithText.verified.txt @@ -0,0 +1 @@ +text-value \ No newline at end of file