From 282e53840528bcea7b4f5d4a74909c98ae75a1ca Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Tue, 12 Jul 2022 15:01:16 +0100 Subject: [PATCH] Add range query (#6516) * Add range query * Remove test until we fix field name --- .../ElasticsearchResponseBaseExtensions.cs | 12 + .../Types/Enums/Enums.QueryDsl.g.cs | 49 ++++ .../Types/Migration/MigrationFeature.g.cs | 12 - .../Types/QueryDsl/DateRangeQuery.g.cs | 229 ++++++++++++++++++ .../Types/QueryDsl/NumberRangeQuery.g.cs | 193 +++++++++++++++ .../Types/QueryDsl/QueryContainer.g.cs | 12 + .../_Generated/Types/QueryDsl/RangeQuery.g.cs | 38 +++ .../Types/QueryDsl/RangeQueryBase.g.cs | 33 +++ .../Queries/MultipleSearchFiltersTests.cs | 2 + 9 files changed, 568 insertions(+), 12 deletions(-) create mode 100644 src/Elastic.Clients.Elasticsearch/Client/ElasticsearchResponseBaseExtensions.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQueryBase.g.cs diff --git a/src/Elastic.Clients.Elasticsearch/Client/ElasticsearchResponseBaseExtensions.cs b/src/Elastic.Clients.Elasticsearch/Client/ElasticsearchResponseBaseExtensions.cs new file mode 100644 index 00000000000..bb31831adb3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/Client/ElasticsearchResponseBaseExtensions.cs @@ -0,0 +1,12 @@ +// 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.Transport.Products.Elasticsearch; + +namespace Elastic.Clients.Elasticsearch; + +public static class ElasticsearchResponseBaseExtensions +{ + public static bool IsSuccess(this ElasticsearchResponseBase response) => response.ApiCall is not null && response.ApiCall.Success; +} 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 5ad0db426b2..926ce41f5e9 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 @@ -500,6 +500,55 @@ public override void Write(Utf8JsonWriter writer, Operator value, JsonSerializer } } + [JsonConverter(typeof(RangeRelationConverter))] + public enum RangeRelation + { + [EnumMember(Value = "within")] + Within, + [EnumMember(Value = "intersects")] + Intersects, + [EnumMember(Value = "contains")] + Contains + } + + internal sealed class RangeRelationConverter : JsonConverter + { + public override RangeRelation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "within": + return RangeRelation.Within; + case "intersects": + return RangeRelation.Intersects; + case "contains": + return RangeRelation.Contains; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, RangeRelation value, JsonSerializerOptions options) + { + switch (value) + { + case RangeRelation.Within: + writer.WriteStringValue("within"); + return; + case RangeRelation.Intersects: + writer.WriteStringValue("intersects"); + return; + case RangeRelation.Contains: + writer.WriteStringValue("contains"); + return; + } + + writer.WriteNullValue(); + } + } + [JsonConverter(typeof(SimpleQueryStringFlagConverter))] public enum SimpleQueryStringFlag { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs index 79a7ea670eb..72faf353cdd 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Migration/MigrationFeature.g.cs @@ -29,17 +29,5 @@ public partial class MigrationFeature [JsonInclude] [JsonPropertyName("feature_name")] public string FeatureName { get; init; } - - [JsonInclude] - [JsonPropertyName("indices")] - public IReadOnlyCollection Indices { get; init; } - - [JsonInclude] - [JsonPropertyName("migration_status")] - public Elastic.Clients.Elasticsearch.Migration.MigrationStatus MigrationStatus { get; init; } - - [JsonInclude] - [JsonPropertyName("minimum_index_version")] - public string MinimumIndexVersion { get; init; } } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs new file mode 100644 index 00000000000..2ab4879aecc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/DateRangeQuery.g.cs @@ -0,0 +1,229 @@ +// 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 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 +{ + public partial class DateRangeQuery : RangeQueryBase + { + [JsonInclude] + [JsonPropertyName("format")] + public string? Format { get; set; } + + [JsonInclude] + [JsonPropertyName("from")] + public string? From { get; set; } + + [JsonInclude] + [JsonPropertyName("gt")] + public string? Gt { get; set; } + + [JsonInclude] + [JsonPropertyName("gte")] + public string? Gte { get; set; } + + [JsonInclude] + [JsonPropertyName("lt")] + public string? Lt { get; set; } + + [JsonInclude] + [JsonPropertyName("lte")] + public string? Lte { get; set; } + + [JsonInclude] + [JsonPropertyName("time_zone")] + public string? TimeZone { get; set; } + + [JsonInclude] + [JsonPropertyName("to")] + public string? To { get; set; } + } + + public sealed partial class DateRangeQueryDescriptor : SerializableDescriptorBase + { + internal DateRangeQueryDescriptor(Action configure) => configure.Invoke(this); + public DateRangeQueryDescriptor() : base() + { + } + + private string? QueryNameValue { get; set; } + + private float? BoostValue { get; set; } + + private string? FormatValue { get; set; } + + private string? FromValue { get; set; } + + private string? GtValue { get; set; } + + private string? GteValue { get; set; } + + private string? LtValue { get; set; } + + private string? LteValue { get; set; } + + private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } + + private string? TimeZoneValue { get; set; } + + private string? ToValue { get; set; } + + public DateRangeQueryDescriptor QueryName(string? queryName) + { + QueryNameValue = queryName; + return Self; + } + + public DateRangeQueryDescriptor Boost(float? boost) + { + BoostValue = boost; + return Self; + } + + public DateRangeQueryDescriptor Format(string? format) + { + FormatValue = format; + return Self; + } + + public DateRangeQueryDescriptor From(string? from) + { + FromValue = from; + return Self; + } + + public DateRangeQueryDescriptor Gt(string? gt) + { + GtValue = gt; + return Self; + } + + public DateRangeQueryDescriptor Gte(string? gte) + { + GteValue = gte; + return Self; + } + + public DateRangeQueryDescriptor Lt(string? lt) + { + LtValue = lt; + return Self; + } + + public DateRangeQueryDescriptor Lte(string? lte) + { + LteValue = lte; + return Self; + } + + public DateRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + { + RelationValue = relation; + return Self; + } + + public DateRangeQueryDescriptor TimeZone(string? timeZone) + { + TimeZoneValue = timeZone; + return Self; + } + + public DateRangeQueryDescriptor To(string? to) + { + ToValue = to; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(QueryNameValue)) + { + writer.WritePropertyName("_name"); + writer.WriteStringValue(QueryNameValue); + } + + if (BoostValue.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(BoostValue.Value); + } + + if (FormatValue is not null) + { + writer.WritePropertyName("format"); + JsonSerializer.Serialize(writer, FormatValue, options); + } + + if (FromValue is not null) + { + writer.WritePropertyName("from"); + JsonSerializer.Serialize(writer, FromValue, options); + } + + if (GtValue is not null) + { + writer.WritePropertyName("gt"); + JsonSerializer.Serialize(writer, GtValue, options); + } + + if (GteValue is not null) + { + writer.WritePropertyName("gte"); + JsonSerializer.Serialize(writer, GteValue, options); + } + + if (LtValue is not null) + { + writer.WritePropertyName("lt"); + JsonSerializer.Serialize(writer, LtValue, options); + } + + if (LteValue is not null) + { + writer.WritePropertyName("lte"); + JsonSerializer.Serialize(writer, LteValue, options); + } + + if (RelationValue is not null) + { + writer.WritePropertyName("relation"); + JsonSerializer.Serialize(writer, RelationValue, options); + } + + if (TimeZoneValue is not null) + { + writer.WritePropertyName("time_zone"); + JsonSerializer.Serialize(writer, TimeZoneValue, options); + } + + if (ToValue is not null) + { + writer.WritePropertyName("to"); + JsonSerializer.Serialize(writer, ToValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs new file mode 100644 index 00000000000..4dd9f53d7bd --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/NumberRangeQuery.g.cs @@ -0,0 +1,193 @@ +// 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 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 +{ + public partial class NumberRangeQuery : RangeQueryBase + { + [JsonInclude] + [JsonPropertyName("from")] + public double? From { get; set; } + + [JsonInclude] + [JsonPropertyName("gt")] + public double? Gt { get; set; } + + [JsonInclude] + [JsonPropertyName("gte")] + public double? Gte { get; set; } + + [JsonInclude] + [JsonPropertyName("lt")] + public double? Lt { get; set; } + + [JsonInclude] + [JsonPropertyName("lte")] + public double? Lte { get; set; } + + [JsonInclude] + [JsonPropertyName("to")] + public double? To { get; set; } + } + + public sealed partial class NumberRangeQueryDescriptor : SerializableDescriptorBase + { + internal NumberRangeQueryDescriptor(Action configure) => configure.Invoke(this); + public NumberRangeQueryDescriptor() : base() + { + } + + private string? QueryNameValue { get; set; } + + private float? BoostValue { get; set; } + + private double? FromValue { get; set; } + + private double? GtValue { get; set; } + + private double? GteValue { get; set; } + + private double? LtValue { get; set; } + + private double? LteValue { get; set; } + + private Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? RelationValue { get; set; } + + private double? ToValue { get; set; } + + public NumberRangeQueryDescriptor QueryName(string? queryName) + { + QueryNameValue = queryName; + return Self; + } + + public NumberRangeQueryDescriptor Boost(float? boost) + { + BoostValue = boost; + return Self; + } + + public NumberRangeQueryDescriptor From(double? from) + { + FromValue = from; + return Self; + } + + public NumberRangeQueryDescriptor Gt(double? gt) + { + GtValue = gt; + return Self; + } + + public NumberRangeQueryDescriptor Gte(double? gte) + { + GteValue = gte; + return Self; + } + + public NumberRangeQueryDescriptor Lt(double? lt) + { + LtValue = lt; + return Self; + } + + public NumberRangeQueryDescriptor Lte(double? lte) + { + LteValue = lte; + return Self; + } + + public NumberRangeQueryDescriptor Relation(Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? relation) + { + RelationValue = relation; + return Self; + } + + public NumberRangeQueryDescriptor To(double? to) + { + ToValue = to; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(QueryNameValue)) + { + writer.WritePropertyName("_name"); + writer.WriteStringValue(QueryNameValue); + } + + if (BoostValue.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(BoostValue.Value); + } + + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (GtValue.HasValue) + { + writer.WritePropertyName("gt"); + writer.WriteNumberValue(GtValue.Value); + } + + if (GteValue.HasValue) + { + writer.WritePropertyName("gte"); + writer.WriteNumberValue(GteValue.Value); + } + + if (LtValue.HasValue) + { + writer.WritePropertyName("lt"); + writer.WriteNumberValue(LtValue.Value); + } + + if (LteValue.HasValue) + { + writer.WritePropertyName("lte"); + writer.WriteNumberValue(LteValue.Value); + } + + if (RelationValue is not null) + { + writer.WritePropertyName("relation"); + JsonSerializer.Serialize(writer, RelationValue, options); + } + + if (ToValue.HasValue) + { + writer.WritePropertyName("to"); + writer.WriteNumberValue(ToValue.Value); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryContainer.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryContainer.g.cs index c01c6ec48c9..ab2f96e12ab 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryContainer.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/QueryContainer.g.cs @@ -79,6 +79,7 @@ public QueryContainer(string variantName, IQueryVariant variant) public static QueryContainer Pinned(Elastic.Clients.Elasticsearch.QueryDsl.PinnedQuery pinnedQuery) => new QueryContainer("pinned", pinnedQuery); public static QueryContainer Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => new QueryContainer("prefix", prefixQuery); public static QueryContainer QueryString(Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery queryStringQuery) => new QueryContainer("query_string", queryStringQuery); + public static QueryContainer Range(Elastic.Clients.Elasticsearch.QueryDsl.RangeQuery rangeQuery) => new QueryContainer("range", rangeQuery); public static QueryContainer RankFeature(Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery rankFeatureQuery) => new QueryContainer("rank_feature", rankFeatureQuery); public static QueryContainer Regexp(Elastic.Clients.Elasticsearch.QueryDsl.RegexpQuery regexpQuery) => new QueryContainer("regexp", regexpQuery); public static QueryContainer Script(Elastic.Clients.Elasticsearch.QueryDsl.ScriptQuery scriptQuery) => new QueryContainer("script", scriptQuery); @@ -304,6 +305,12 @@ public override QueryContainer Read(ref Utf8JsonReader reader, Type typeToConver return new QueryContainer(propertyName, variant); } + if (propertyName == "range") + { + var variant = JsonSerializer.Deserialize(ref reader, options); + return new QueryContainer(propertyName, variant); + } + if (propertyName == "rank_feature") { var variant = JsonSerializer.Deserialize(ref reader, options); @@ -523,6 +530,9 @@ public override void Write(Utf8JsonWriter writer, QueryContainer value, JsonSeri case "query_string": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.QueryStringQuery)value.Variant, options); break; + case "range": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.RangeQuery)value.Variant, options); + break; case "rank_feature": JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.RankFeatureQuery)value.Variant, options); break; @@ -709,6 +719,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o public void Prefix(Action> configure) => Set(configure, "prefix"); public void QueryString(QueryStringQuery query) => Set(query, "query_string"); public void QueryString(Action> configure) => Set(configure, "query_string"); + public void Range(RangeQuery query) => Set(query, "range"); public void RankFeature(RankFeatureQuery query) => Set(query, "rank_feature"); public void RankFeature(Action> configure) => Set(configure, "rank_feature"); public void Regexp(RegexpQuery query) => Set(query, "regexp"); @@ -900,6 +911,7 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o public void QueryString(QueryStringQuery query) => Set(query, "query_string"); public void QueryString(Action configure) => Set(configure, "query_string"); public void QueryString(Action> configure) => Set(configure, "query_string"); + public void Range(RangeQuery query) => Set(query, "range"); public void RankFeature(RankFeatureQuery query) => Set(query, "rank_feature"); public void RankFeature(Action configure) => Set(configure, "rank_feature"); public void RankFeature(Action> configure) => Set(configure, "rank_feature"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQuery.g.cs new file mode 100644 index 00000000000..6b60614732c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQuery.g.cs @@ -0,0 +1,38 @@ +// 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.Transport; +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 +{ + public partial class RangeQuery : Union, IQueryVariant + { + public RangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery dateRangeQuery) : base(dateRangeQuery) + { + } + + public RangeQuery(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery numberRangeQuery) : base(numberRangeQuery) + { + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQueryBase.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQueryBase.g.cs new file mode 100644 index 00000000000..48afe3b5aec --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/RangeQueryBase.g.cs @@ -0,0 +1,33 @@ +// 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 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 +{ + public abstract partial class RangeQueryBase : QueryBase + { + [JsonInclude] + [JsonPropertyName("relation")] + public Elastic.Clients.Elasticsearch.QueryDsl.RangeRelation? Relation { get; set; } + } +} \ No newline at end of file diff --git a/tests/Tests/Serialization/Queries/MultipleSearchFiltersTests.cs b/tests/Tests/Serialization/Queries/MultipleSearchFiltersTests.cs index 0f45282bf61..b4d4a942cdd 100644 --- a/tests/Tests/Serialization/Queries/MultipleSearchFiltersTests.cs +++ b/tests/Tests/Serialization/Queries/MultipleSearchFiltersTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Threading.Tasks; +using Elastic.Clients.Elasticsearch.QueryDsl; using VerifyXunit; namespace Tests.Serialization; @@ -19,6 +20,7 @@ public async Task CanSerialize_AvgAggregation_Descriptor() .Filter( f => f.Term(t => t.Field(f => f.Age).Value(37)), f => f.Term(t => t.Field(f => f.Name).Value("Steve")) + //f => f.Range(new RangeQuery(new DateRangeQuery { Gte = "now-1d/d", Lt = "now/d" })) )))); var serialisedJson = await SerializeAndGetJsonStringAsync(search);