Skip to content

Commit 45efa3b

Browse files
committed
Cleaning up geo as per elastic/elasticsearch#22876
* For `geo_distance` queries, sorting, and aggregations the `sloppy_arc` option * The `geo_distance_range` query, which was deprecated in 5.0, has been removed. * The `optimize_bbox` parameter has been removed from `geo_distance` queries. * The `ignore_malformed` and `coerce` parameters have been removed from `geo_bounding_box`, `geo_polygon`, and `geo_distance` queries.
1 parent 0a32831 commit 45efa3b

File tree

16 files changed

+14
-319
lines changed

16 files changed

+14
-319
lines changed

src/Nest/Nest.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,11 +1109,9 @@
11091109
<Compile Include="QueryDsl\Geo\BoundingBox\BoundingBox.cs" />
11101110
<Compile Include="QueryDsl\Geo\BoundingBox\GeoBoundingBoxQuery.cs" />
11111111
<Compile Include="QueryDsl\Geo\BoundingBox\GeoExecution.cs" />
1112-
<Compile Include="QueryDsl\Geo\DistanceRange\GeoDistanceRangeQuery.cs" />
11131112
<Compile Include="QueryDsl\Geo\Distance\GeoDistanceQuery.cs" />
11141113
<Compile Include="QueryDsl\Geo\GeoCoordinateJsonConverter.cs" />
11151114
<Compile Include="QueryDsl\Geo\GeoLocation.cs" />
1116-
<Compile Include="QueryDsl\Geo\GeoOptimizeBBox.cs" />
11171115
<Compile Include="QueryDsl\Geo\GeoValidationMethod.cs" />
11181116
<Compile Include="QueryDsl\Geo\HashCell\GeoHashCellQuery.cs" />
11191117
<Compile Include="QueryDsl\Geo\LatLon.cs" />

src/Nest/QueryDsl/Abstractions/Container/IQueryContainer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ public interface IQueryContainer
149149
[JsonProperty("geo_polygon")]
150150
IGeoPolygonQuery GeoPolygon { get; set; }
151151

152-
[JsonProperty("geo_distance_range")]
153-
IGeoDistanceRangeQuery GeoDistanceRange { get; set; }
154-
155152
[JsonProperty("geohash_cell")]
156153
IGeoHashCellQuery GeoHashCell { get; set; }
157154

src/Nest/QueryDsl/Abstractions/Container/QueryContainer-Assignments.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public partial class QueryContainer : IQueryContainer, IDescriptor
5050
private IGeoBoundingBoxQuery _geoBoundingBox;
5151
private IGeoDistanceQuery _geoDistance;
5252
private IGeoPolygonQuery _geoPolygon;
53-
private IGeoDistanceRangeQuery _geoDistanceRange;
5453
private IGeoHashCellQuery _geoHashCell;
5554
private IScriptQuery _script;
5655
private IExistsQuery _exists;
@@ -115,7 +114,6 @@ private T Set<T>(T value) where T : IQuery
115114
IGeoBoundingBoxQuery IQueryContainer.GeoBoundingBox { get { return _geoBoundingBox; } set { _geoBoundingBox = Set(value); } }
116115
IGeoDistanceQuery IQueryContainer.GeoDistance { get { return _geoDistance; } set { _geoDistance = Set(value); } }
117116
IGeoPolygonQuery IQueryContainer.GeoPolygon { get { return _geoPolygon; } set { _geoPolygon = Set(value); } }
118-
IGeoDistanceRangeQuery IQueryContainer.GeoDistanceRange { get { return _geoDistanceRange; } set { _geoDistanceRange = Set(value); } }
119117
IGeoHashCellQuery IQueryContainer.GeoHashCell { get { return _geoHashCell; } set { _geoHashCell = Set(value); } }
120118
IScriptQuery IQueryContainer.Script { get { return _script; } set { _script = Set(value); } }
121119
IExistsQuery IQueryContainer.Exists { get { return _exists; } set { _exists = Set(value); } }

src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public QueryContainer Terms(Func<TermsQueryDescriptor<T>, ITermsQuery> selector)
7171

7272
/// <summary>
7373
/// A fuzzy based query that uses similarity based on Levenshtein (edit distance) algorithm.
74-
/// Warning: this query is not very scalable with its default prefix length of 0 in this case,
74+
/// Warning: this query is not very scalable with its default prefix length of 0 in this case,
7575
/// every term will be enumerated and cause an edit score calculation or max_expansions is not set.
7676
/// </summary>
7777
public QueryContainer Fuzzy(Func<FuzzyQueryDescriptor<T>, IFuzzyQuery> selector) =>
@@ -157,7 +157,7 @@ public QueryContainer TermRange(Func<TermRangeQueryDescriptor<T>, ITermRangeQuer
157157
WrapInContainer(selector, (query, container) => container.Range = query);
158158

159159
/// <summary>
160-
/// More like this query find documents that are like provided text by running it against one or more fields.
160+
/// More like this query find documents that are like provided text by running it against one or more fields.
161161
/// </summary>
162162
public QueryContainer MoreLikeThis(Func<MoreLikeThisQueryDescriptor<T>, IMoreLikeThisQuery> selector) =>
163163
WrapInContainer(selector, (query, container) => container.MoreLikeThis = query);
@@ -241,13 +241,6 @@ public QueryContainer GeoPolygon(Func<GeoPolygonQueryDescriptor<T>, IGeoPolygonQ
241241
public QueryContainer GeoHashCell(Func<GeoHashCellQueryDescriptor<T>, IGeoHashCellQuery> selector) =>
242242
WrapInContainer(selector, (query, container) => container.GeoHashCell = query);
243243

244-
/// <summary>
245-
/// Matches documents with a geo_point type field to include only those
246-
/// that exist within a specific distance range from a given geo_point
247-
/// </summary>
248-
public QueryContainer GeoDistanceRange(Func<GeoDistanceRangeQueryDescriptor<T>, IGeoDistanceRangeQuery> selector) =>
249-
WrapInContainer(selector, (query, container) => container.GeoDistanceRange = query);
250-
251244
/// <summary>
252245
/// Matches documents with a geo_point type field to include only those
253246
/// that exist within a specific distance from a given geo_point
@@ -449,14 +442,14 @@ public QueryContainer SpanMultiTerm(Func<SpanMultiTermQueryDescriptor<T>, ISpanM
449442
WrapInContainer(selector, (query, container) => container.SpanMultiTerm = query);
450443

451444
/// <summary>
452-
/// Returns matches which enclose another span query.
445+
/// Returns matches which enclose another span query.
453446
/// The span containing query maps to Lucene SpanContainingQuery
454447
/// </summary>
455448
public QueryContainer SpanContaining(Func<SpanContainingQueryDescriptor<T>, ISpanContainingQuery> selector) =>
456449
WrapInContainer(selector, (query, container) => container.SpanContaining = query);
457450

458451
/// <summary>
459-
/// Returns Matches which are enclosed inside another span query.
452+
/// Returns Matches which are enclosed inside another span query.
460453
/// The span within query maps to Lucene SpanWithinQuery
461454
/// </summary>
462455
public QueryContainer SpanWithin(Func<SpanWithinQueryDescriptor<T>, ISpanWithinQuery> selector) =>
@@ -472,8 +465,8 @@ public QueryContainer SpanFieldMasking(Func<SpanFieldMaskingQueryDescriptor<T>,
472465
WrapInContainer(selector, (query, container) => container.SpanFieldMasking = query);
473466

474467
/// <summary>
475-
/// Allows you to use regular expression term queries.
476-
/// "term queries" means that Elasticsearch will apply the regexp to the terms produced
468+
/// Allows you to use regular expression term queries.
469+
/// "term queries" means that Elasticsearch will apply the regexp to the terms produced
477470
/// by the tokenizer for that field, and not to the original text of the field.
478471
/// </summary>
479472
public QueryContainer Regexp(Func<RegexpQueryDescriptor<T>, IRegexpQuery> selector) =>

src/Nest/QueryDsl/Geo/BoundingBox/GeoBoundingBoxQuery.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ public interface IGeoBoundingBoxQuery : IFieldNameQuery
1313
[JsonProperty("type")]
1414
GeoExecution? Type { get; set; }
1515

16-
[Obsolete("Deprecated. Use ValidationMethod")]
17-
[JsonProperty("coerce")]
18-
bool? Coerce { get; set; }
19-
20-
[Obsolete("Deprecated. Use ValidationMethod")]
21-
[JsonProperty("ignore_malformed")]
22-
bool? IgnoreMalformed { get; set; }
23-
2416
[JsonProperty("validation_method")]
2517
GeoValidationMethod? ValidationMethod { get; set; }
2618
}
@@ -32,11 +24,6 @@ public class GeoBoundingBoxQuery : FieldNameQueryBase, IGeoBoundingBoxQuery
3224
public IBoundingBox BoundingBox { get; set; }
3325
public GeoExecution? Type { get; set; }
3426

35-
[Obsolete("Deprecated. Use ValidationMethod")]
36-
public bool? Coerce { get; set; }
37-
38-
[Obsolete("Deprecated. Use ValidationMethod")]
39-
public bool? IgnoreMalformed { get; set; }
4027
public GeoValidationMethod? ValidationMethod { get; set; }
4128

4229
internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoBoundingBox = this;
@@ -52,8 +39,6 @@ public class GeoBoundingBoxQueryDescriptor<T>
5239
protected override bool Conditionless => GeoBoundingBoxQuery.IsConditionless(this);
5340
IBoundingBox IGeoBoundingBoxQuery.BoundingBox { get; set; }
5441
GeoExecution? IGeoBoundingBoxQuery.Type { get; set; }
55-
bool? IGeoBoundingBoxQuery.Coerce { get; set; }
56-
bool? IGeoBoundingBoxQuery.IgnoreMalformed { get; set; }
5742
GeoValidationMethod? IGeoBoundingBoxQuery.ValidationMethod { get; set; }
5843

5944
public GeoBoundingBoxQueryDescriptor<T> BoundingBox(double topLeftLat, double topLeftLon, double bottomRightLat, double bottomRightLon) =>
@@ -67,12 +52,6 @@ public GeoBoundingBoxQueryDescriptor<T> BoundingBox(Func<BoundingBoxDescriptor,
6752

6853
public GeoBoundingBoxQueryDescriptor<T> Type(GeoExecution type) => Assign(a => a.Type = type);
6954

70-
[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
71-
public GeoBoundingBoxQueryDescriptor<T> Coerce(bool? coerce = true) => Assign(a => a.Coerce = coerce);
72-
73-
[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
74-
public GeoBoundingBoxQueryDescriptor<T> IgnoreMalformed(bool? ignore = true) => Assign(a => a.IgnoreMalformed = ignore);
75-
7655
public GeoBoundingBoxQueryDescriptor<T> ValidationMethod(GeoValidationMethod? validation) => Assign(a => a.ValidationMethod = validation);
7756
}
7857
}

src/Nest/QueryDsl/Geo/Distance/GeoDistanceQuery.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,9 @@ public interface IGeoDistanceQuery : IFieldNameQuery
1313
[JsonProperty("distance")]
1414
Distance Distance { get; set; }
1515

16-
[JsonProperty("optimize_bbox")]
17-
GeoOptimizeBBox? OptimizeBoundingBox { get; set; }
18-
1916
[JsonProperty("distance_type")]
2017
GeoDistanceType? DistanceType { get; set; }
2118

22-
[Obsolete("Deprecated. Use ValidationMethod")]
23-
[JsonProperty("coerce")]
24-
bool? Coerce { get; set; }
25-
26-
[Obsolete("Deprecated. Use ValidationMethod")]
27-
[JsonProperty("ignore_malformed")]
28-
bool? IgnoreMalformed { get; set; }
29-
3019
[JsonProperty("validation_method")]
3120
GeoValidationMethod? ValidationMethod { get; set; }
3221

@@ -37,15 +26,7 @@ public class GeoDistanceQuery : FieldNameQueryBase, IGeoDistanceQuery
3726
protected override bool Conditionless => IsConditionless(this);
3827
public GeoLocation Location { get; set; }
3928
public Distance Distance { get; set; }
40-
public GeoOptimizeBBox? OptimizeBoundingBox { get; set; }
4129
public GeoDistanceType? DistanceType { get; set; }
42-
43-
[Obsolete("Deprecated. Use ValidationMethod")]
44-
public bool? Coerce { get; set; }
45-
46-
[Obsolete("Deprecated. Use ValidationMethod")]
47-
public bool? IgnoreMalformed { get; set; }
48-
4930
public GeoValidationMethod? ValidationMethod { get; set; }
5031

5132
internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoDistance = this;
@@ -62,9 +43,6 @@ public class GeoDistanceQueryDescriptor<T>
6243
GeoLocation IGeoDistanceQuery.Location { get; set; }
6344
Distance IGeoDistanceQuery.Distance { get; set; }
6445
GeoDistanceType? IGeoDistanceQuery.DistanceType { get; set; }
65-
GeoOptimizeBBox? IGeoDistanceQuery.OptimizeBoundingBox { get; set; }
66-
bool? IGeoDistanceQuery.Coerce { get; set; }
67-
bool? IGeoDistanceQuery.IgnoreMalformed { get; set; }
6846
GeoValidationMethod? IGeoDistanceQuery.ValidationMethod { get; set; }
6947

7048
public GeoDistanceQueryDescriptor<T> Location(GeoLocation location) => Assign(a => a.Location = location);
@@ -75,16 +53,8 @@ public class GeoDistanceQueryDescriptor<T>
7553

7654
public GeoDistanceQueryDescriptor<T> Distance(double distance, DistanceUnit unit) => Assign(a => a.Distance = new Distance(distance, unit));
7755

78-
public GeoDistanceQueryDescriptor<T> Optimize(GeoOptimizeBBox optimize) => Assign(a => a.OptimizeBoundingBox = optimize);
79-
8056
public GeoDistanceQueryDescriptor<T> DistanceType(GeoDistanceType type) => Assign(a => a.DistanceType = type);
8157

82-
[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
83-
public GeoDistanceQueryDescriptor<T> Coerce(bool? coerce = true) => Assign(a => a.Coerce = coerce);
84-
85-
[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
86-
public GeoDistanceQueryDescriptor<T> IgnoreMalformed(bool? ignore = true) => Assign(a => a.IgnoreMalformed = ignore);
87-
8858
public GeoDistanceQueryDescriptor<T> ValidationMethod(GeoValidationMethod? validation) => Assign(a => a.ValidationMethod = validation);
8959
}
9060
}

src/Nest/QueryDsl/Geo/DistanceRange/GeoDistanceRangeQuery.cs

Lines changed: 0 additions & 115 deletions
This file was deleted.

src/Nest/QueryDsl/Geo/GeoOptimizeBBox.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Nest/QueryDsl/Geo/Polygon/GeoPolygonQuery.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ public interface IGeoPolygonQuery : IFieldNameQuery
1111
[VariableField("points")]
1212
IEnumerable<GeoLocation> Points { get; set; }
1313

14-
[Obsolete("Deprecated. Use ValidationMethod")]
15-
[JsonProperty("coerce")]
16-
bool? Coerce { get; set; }
17-
18-
[Obsolete("Deprecated. Use ValidationMethod")]
19-
[JsonProperty("ignore_malformed")]
20-
bool? IgnoreMalformed { get; set; }
21-
2214
[JsonProperty("validation_method")]
2315
GeoValidationMethod? ValidationMethod { get; set; }
2416

@@ -29,11 +21,6 @@ public class GeoPolygonQuery : FieldNameQueryBase, IGeoPolygonQuery
2921
protected override bool Conditionless => IsConditionless(this);
3022
public IEnumerable<GeoLocation> Points { get; set; }
3123

32-
[Obsolete("Deprecated. Use ValidationMethod")]
33-
public bool? Coerce { get; set; }
34-
35-
[Obsolete("Deprecated. Use ValidationMethod")]
36-
public bool? IgnoreMalformed { get; set; }
3724
public GeoValidationMethod? ValidationMethod { get; set; }
3825

3926
internal override void InternalWrapInContainer(IQueryContainer c) => c.GeoPolygon = this;
@@ -46,20 +33,12 @@ public class GeoPolygonQueryDescriptor<T>
4633
{
4734
protected override bool Conditionless => GeoPolygonQuery.IsConditionless(this);
4835
IEnumerable<GeoLocation> IGeoPolygonQuery.Points { get; set; }
49-
bool? IGeoPolygonQuery.Coerce { get; set; }
50-
bool? IGeoPolygonQuery.IgnoreMalformed { get; set; }
5136
GeoValidationMethod? IGeoPolygonQuery.ValidationMethod { get; set; }
5237

5338
public GeoPolygonQueryDescriptor<T> Points(IEnumerable<GeoLocation> points) => Assign(a => a.Points = points);
5439

5540
public GeoPolygonQueryDescriptor<T> Points(params GeoLocation[] points) => Assign(a => a.Points = points);
5641

57-
[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
58-
public GeoPolygonQueryDescriptor<T> Coerce(bool? coerce = true) => Assign(a => a.Coerce = coerce);
59-
60-
[Obsolete("Deprecated. Use ValidationMethod(GeoValidationMethod? validation)")]
61-
public GeoPolygonQueryDescriptor<T> IgnoreMalformed(bool? ignore = true) => Assign(a => a.IgnoreMalformed = ignore);
62-
6342
public GeoPolygonQueryDescriptor<T> ValidationMethod(GeoValidationMethod? validation) => Assign(a => a.ValidationMethod = validation);
6443
}
6544
}

0 commit comments

Comments
 (0)