Skip to content

Commit 2bdd10b

Browse files
committed
Fix #3318 Support 3rd dimension (Z value) to points for geo_point and… (#3365)
This commit adds support for 3rd dimension (Z value) to points for geo_shapes GeoShapeAttribute needs to implement IGeoShapeProperty
1 parent c6ae5c9 commit 2bdd10b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public GeoShapeAttribute() : base(FieldType.GeoShape) { }
1515
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
1616
bool? IGeoShapeProperty.PointsOnly { get; set; }
1717
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
18+
bool? IGeoShapeProperty.IgnoreZValue { get; set; }
1819

1920
/// <inheritdoc cref="IGeoShapeProperty.Tree"/>
2021
public GeoTree Tree { get => Self.Tree.GetValueOrDefault(GeoTree.Geohash); set => Self.Tree = value; }
@@ -36,5 +37,7 @@ public double DistanceErrorPercentage
3637
public bool PointsOnly { get => Self.PointsOnly.GetValueOrDefault(false); set => Self.PointsOnly = value; }
3738
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed"/>
3839
public bool IgnoreMalformed { get => Self.IgnoreMalformed.GetValueOrDefault(false); set => Self.IgnoreMalformed = value; }
40+
/// <inheritdoc cref="IGeoShapeProperty.IgnoreZValue"/>
41+
public bool IgnoreZValue { get => Self.IgnoreZValue.GetValueOrDefault(true); set => Self.IgnoreZValue = value; }
3942
}
4043
}

src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ public interface IGeoShapeProperty : IDocValuesProperty
8585
/// </remarks>
8686
[JsonProperty("ignore_malformed")]
8787
bool? IgnoreMalformed { get; set; }
88+
89+
/// <summary>
90+
/// If true (default) three dimension points will be accepted (stored in source) but
91+
/// only latitude and longitude values will be indexed; the third dimension is ignored. If false,
92+
/// geo-points containing any more than latitude and longitude (two dimensions) values throw
93+
/// an exception and reject the whole document.
94+
/// </summary>
95+
/// <remarks>
96+
/// Valid for Elasticsearch 6.3.0+
97+
/// </remarks>
98+
[JsonProperty("ignore_z_value")]
99+
bool? IgnoreZValue { get; set; }
88100
}
89101

90102
/// <inheritdoc cref="IGeoShapeProperty" />
@@ -116,6 +128,9 @@ public GeoShapeProperty() : base(FieldType.GeoShape) { }
116128

117129
/// <inheritdoc />
118130
public bool? IgnoreMalformed { get; set; }
131+
132+
/// <inheritdoc />
133+
public bool? IgnoreZValue { get; set; }
119134
}
120135

121136
/// <inheritdoc cref="IGeoShapeProperty"/>
@@ -132,6 +147,7 @@ public class GeoShapePropertyDescriptor<T>
132147
double? IGeoShapeProperty.DistanceErrorPercentage { get; set; }
133148
bool? IGeoShapeProperty.PointsOnly { get; set; }
134149
bool? IGeoShapeProperty.IgnoreMalformed { get; set; }
150+
bool? IGeoShapeProperty.IgnoreZValue { get; set; }
135151

136152
public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { }
137153

@@ -161,5 +177,9 @@ public GeoShapePropertyDescriptor<T> DistanceErrorPercentage(double? distanceErr
161177
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed"/>
162178
public GeoShapePropertyDescriptor<T> IgnoreMalformed(bool? ignoreMalformed = true) =>
163179
Assign(a => a.IgnoreMalformed = ignoreMalformed);
180+
181+
/// <inheritdoc cref="IGeoShapeProperty.IgnoreZValue"/>
182+
public GeoShapePropertyDescriptor<T> IgnoreZValue(bool? ignoreZValue = true) =>
183+
Assign(a => a.IgnoreZValue = ignoreZValue);
164184
}
165185
}

0 commit comments

Comments
 (0)