Skip to content

Fix #3318 Support 3rd dimension (Z value) to points for geo_point and… #3365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

/// <inheritdoc cref="IGeoShapeProperty.Tree"/>
public GeoTree Tree { get => Self.Tree.GetValueOrDefault(GeoTree.Geohash); set => Self.Tree = value; }
Expand All @@ -36,5 +37,7 @@ public double DistanceErrorPercentage
public bool PointsOnly { get => Self.PointsOnly.GetValueOrDefault(false); set => Self.PointsOnly = value; }
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed"/>
public bool IgnoreMalformed { get => Self.IgnoreMalformed.GetValueOrDefault(false); set => Self.IgnoreMalformed = value; }
/// <inheritdoc cref="IGeoShapeProperty.IgnoreZValue"/>
public bool IgnoreZValue { get => Self.IgnoreZValue.GetValueOrDefault(true); set => Self.IgnoreZValue = value; }
}
}
20 changes: 20 additions & 0 deletions src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public interface IGeoShapeProperty : IDocValuesProperty
/// </remarks>
[JsonProperty("ignore_malformed")]
bool? IgnoreMalformed { get; set; }

/// <summary>
/// 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.
/// </summary>
/// <remarks>
/// Valid for Elasticsearch 6.3.0+
/// </remarks>
[JsonProperty("ignore_z_value")]
bool? IgnoreZValue { get; set; }
}

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

/// <inheritdoc />
public bool? IgnoreMalformed { get; set; }

/// <inheritdoc />
public bool? IgnoreZValue { get; set; }
}

/// <inheritdoc cref="IGeoShapeProperty"/>
Expand All @@ -132,6 +147,7 @@ public class GeoShapePropertyDescriptor<T>
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) { }

Expand Down Expand Up @@ -161,5 +177,9 @@ public GeoShapePropertyDescriptor<T> DistanceErrorPercentage(double? distanceErr
/// <inheritdoc cref="IGeoShapeProperty.IgnoreMalformed"/>
public GeoShapePropertyDescriptor<T> IgnoreMalformed(bool? ignoreMalformed = true) =>
Assign(a => a.IgnoreMalformed = ignoreMalformed);

/// <inheritdoc cref="IGeoShapeProperty.IgnoreZValue"/>
public GeoShapePropertyDescriptor<T> IgnoreZValue(bool? ignoreZValue = true) =>
Assign(a => a.IgnoreZValue = ignoreZValue);
}
}