Skip to content

Commit c8e1604

Browse files
committed
Fix #3323 Add support for null_value, ignore_z_value on GeoPoint property
1 parent 67eb409 commit c8e1604

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointProperty.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,45 @@ namespace Nest
77
[JsonObject(MemberSerialization.OptIn)]
88
public interface IGeoPointProperty : IDocValuesProperty
99
{
10+
/// <summary>
11+
/// If true, malformed geo-points are ignored. If false (default), malformed
12+
/// geo-points throw an exception and reject the whole document.
13+
/// </summary>
1014
[JsonProperty("ignore_malformed")]
1115
bool? IgnoreMalformed { get; set; }
16+
17+
18+
/// <summary>
19+
/// If true (default) three dimension points will be accepted (stored in source) but only
20+
/// latitude and longitude values will be indexed; the third dimension is ignored. If false, geo-points
21+
/// containing any more than latitude and longitude (two dimensions) values
22+
/// throw an exception and reject the whole document.
23+
/// </summary>
24+
[JsonProperty("ignore_z_value")]
25+
bool? IgnoreZValue { get; set; }
26+
27+
/// <summary>
28+
/// Accepts an geopoint value which is substituted for any explicit null values.
29+
/// Defaults to null, which means the field is treated as missing.
30+
/// </summary>
31+
[JsonProperty("null_value")]
32+
GeoLocation NullValue { get; set; }
33+
1234
}
1335

1436
[DebuggerDisplay("{DebugDisplay}")]
1537
public class GeoPointProperty : DocValuesPropertyBase, IGeoPointProperty
1638
{
1739
public GeoPointProperty() : base(FieldType.GeoPoint) { }
1840

41+
/// <inheritdoc />
1942
public bool? IgnoreMalformed { get; set; }
43+
44+
/// <inheritdoc />
45+
public bool? IgnoreZValue { get; set; }
46+
47+
/// <inheritdoc />
48+
public GeoLocation NullValue { get; set; }
2049
}
2150

2251
[DebuggerDisplay("{DebugDisplay}")]
@@ -25,9 +54,18 @@ public class GeoPointPropertyDescriptor<T>
2554
where T : class
2655
{
2756
bool? IGeoPointProperty.IgnoreMalformed { get; set; }
57+
bool? IGeoPointProperty.IgnoreZValue { get; set; }
58+
GeoLocation IGeoPointProperty.NullValue { get; set; }
2859

2960
public GeoPointPropertyDescriptor() : base(FieldType.GeoPoint) { }
3061

62+
/// <inheritdoc cref="IGeoPointProperty.IgnoreMalformed" />
3163
public GeoPointPropertyDescriptor<T> IgnoreMalformed(bool? ignoreMalformed = true) => Assign(a => a.IgnoreMalformed = ignoreMalformed);
64+
65+
/// <inheritdoc cref="IGeoPointProperty.IgnoreZValue" />
66+
public GeoPointPropertyDescriptor<T> IgnoreZValue(bool? ignoreZValue = true) => Assign(a => a.IgnoreZValue = ignoreZValue);
67+
68+
/// <inheritdoc cref="IGeoPointProperty.NullValue" />
69+
public GeoPointPropertyDescriptor<T> NullValue(GeoLocation defaultValue) => Assign(a => a.NullValue = defaultValue);
3270
}
3371
}

0 commit comments

Comments
 (0)