From 0ce0e3585dcf6452e3d9f2b98659010f4b34bbbe Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Sun, 12 Aug 2018 21:42:14 +0200 Subject: [PATCH 1/3] Fix #3318 Support 3rd dimension (Z value) to points for geo_point and points in geo_shapes --- .../Types/Geo/GeoShape/GeoShapeProperty.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs index a1717fa3163..aefbf6fb46b 100644 --- a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs +++ b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs @@ -85,6 +85,18 @@ public interface IGeoShapeProperty : IDocValuesProperty /// [JsonProperty("ignore_malformed")] bool? IgnoreMalformed { get; set; } + + /// + /// If true (default) three dimension points will be accepted (stored in source) but + /// only latitude and longitude values will be indexed; the third dimension is ignored. If false, + /// geo-points containing any more than latitude and longitude (two dimensions) values throw + /// an exception and reject the whole document. + /// + /// + /// Valid for Elasticsearch 6.3.0+ + /// + [JsonProperty("ignore_z_value")] + bool? IgnoreZValue { get; set; } } /// @@ -116,6 +128,9 @@ public GeoShapeProperty() : base(FieldType.GeoShape) { } /// public bool? IgnoreMalformed { get; set; } + + /// + public bool? IgnoreZValue { get; set; } } /// @@ -132,6 +147,7 @@ public class GeoShapePropertyDescriptor double? IGeoShapeProperty.DistanceErrorPercentage { get; set; } bool? IGeoShapeProperty.PointsOnly { get; set; } bool? IGeoShapeProperty.IgnoreMalformed { get; set; } + bool? IGeoShapeProperty.IgnoreZValue { get; set; } public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { } @@ -161,5 +177,9 @@ public GeoShapePropertyDescriptor DistanceErrorPercentage(double? distanceErr /// public GeoShapePropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) => Assign(a => a.IgnoreMalformed = ignoreMalformed); + + /// + public GeoShapePropertyDescriptor IgnoreZValue(bool? ignoreZValue = true) => + Assign(a => a.IgnoreZValue = ignoreZValue); } } From 16e43e6444797f39a5d24269f07275a0892ca712 Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Wed, 15 Aug 2018 13:30:16 +0200 Subject: [PATCH 2/3] GeoShapeAttribute needs to implement IGeoShapeProperty --- src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs index 15dd1df5bee..3fe98b6d5d2 100644 --- a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs +++ b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs @@ -15,6 +15,7 @@ public GeoShapeAttribute() : base(FieldType.GeoShape) { } double? IGeoShapeProperty.DistanceErrorPercentage { get; set; } bool? IGeoShapeProperty.PointsOnly { get; set; } bool? IGeoShapeProperty.IgnoreMalformed { get; set; } + bool? IGeoShapeProperty.IgnoreZValue { get; set; } /// public GeoTree Tree { get => Self.Tree.GetValueOrDefault(GeoTree.Geohash); set => Self.Tree = value; } @@ -36,5 +37,7 @@ public double DistanceErrorPercentage public bool PointsOnly { get => Self.PointsOnly.GetValueOrDefault(false); set => Self.PointsOnly = value; } /// public bool IgnoreMalformed { get => Self.IgnoreMalformed.GetValueOrDefault(false); set => Self.IgnoreMalformed = value; } + /// + public bool IgnoreZValue { get => Self.IgnoreZValue.GetValueOrDefault(false); set => Self.IgnoreZValue = value; } } } From 3929e5134b1078bd7694fca9353933b8996ab1cc Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Mon, 20 Aug 2018 11:24:07 +1000 Subject: [PATCH 3/3] Change default to true --- src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs index 3fe98b6d5d2..ef3cb1ee8f8 100644 --- a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs +++ b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs @@ -38,6 +38,6 @@ public double DistanceErrorPercentage /// public bool IgnoreMalformed { get => Self.IgnoreMalformed.GetValueOrDefault(false); set => Self.IgnoreMalformed = value; } /// - public bool IgnoreZValue { get => Self.IgnoreZValue.GetValueOrDefault(false); set => Self.IgnoreZValue = value; } + public bool IgnoreZValue { get => Self.IgnoreZValue.GetValueOrDefault(true); set => Self.IgnoreZValue = value; } } }