Skip to content

Commit 7d715d1

Browse files
committed
Support GeometryCollection geo_shape types and queries
Tidy up xml comments on queries Fix warnings Renamed ShapeQueryUsageTestsBase -> GeoShapeQueryUsageTestsBase Closes #2387 (cherry picked from commit 1a39a5a)
1 parent ae02b91 commit 7d715d1

33 files changed

+752
-235
lines changed

docs/client-concepts/connection-pooling/building-blocks/request-pipelines.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ var response = new
128128
transport_address = "127.0.0.1:9300",
129129
host = "127.0.0.1",
130130
ip = "127.0.01",
131-
version = "5.0.0-alpha3",
131+
version = "2.4.3",
132132
build = "e455fd0",
133133
http_address = "127.0.0.1:9200",
134134
settings = new JObject

docs/client-concepts/connection-pooling/request-overrides/disable-sniff-ping-per-request.asciidoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ new ClientCall()
6464
);
6565
----
6666
<1> disable sniffing
67-
6867
<2> first call is a successful ping
69-
7068
<3> sniff on startup call happens here, on the second call
7169

7270
Now, let's disable pinging on the request
@@ -89,7 +87,6 @@ audit = await audit.TraceCall(
8987
);
9088
----
9189
<1> disable ping
92-
9390
<2> No ping after sniffing
9491

9592
Finally, let's demonstrate disabling both sniff and ping on the request
@@ -111,6 +108,5 @@ audit = await audit.TraceCall(
111108
);
112109
----
113110
<1> diable ping and sniff
114-
115111
<2> no ping or sniff before the call
116112

docs/query-dsl-usage.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ include::query-dsl/geo/shape/circle/geo-shape-circle-usage.asciidoc[]
6262

6363
include::query-dsl/geo/shape/envelope/geo-envelope-usage.asciidoc[]
6464

65+
include::query-dsl/geo/shape/geometry-collection/geo-geometry-collection-usage.asciidoc[]
66+
6567
include::query-dsl/geo/shape/indexed-shape/geo-indexed-shape-usage.asciidoc[]
6668

6769
include::query-dsl/geo/shape/line-string/geo-line-string-usage.asciidoc[]
@@ -70,6 +72,8 @@ include::query-dsl/geo/shape/multi-line-string/geo-multi-line-string-usage.ascii
7072

7173
include::query-dsl/geo/shape/multi-point/geo-multi-point-usage.asciidoc[]
7274

75+
include::query-dsl/geo/shape/multi-polygon/geo-multi-polygon-usage.asciidoc[]
76+
7377
include::query-dsl/geo/shape/point/geo-point-usage.asciidoc[]
7478

7579
include::query-dsl/geo/shape/polygon/geo-polygon-usage.asciidoc[]

docs/query-dsl.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ NEST exposes all of the query DSL endpoints available in Elasticsearch
6969

7070
* <<geo-envelope-usage,Geo Envelope Usage>>
7171

72+
* <<geo-geometry-collection-usage,Geo Geometry Collection Usage>>
73+
7274
* <<geo-indexed-shape-usage,Geo Indexed Shape Usage>>
7375

7476
* <<geo-line-string-usage,Geo Line String Usage>>
@@ -77,6 +79,8 @@ NEST exposes all of the query DSL endpoints available in Elasticsearch
7779

7880
* <<geo-multi-point-usage,Geo Multi Point Usage>>
7981

82+
* <<geo-multi-polygon-usage,Geo Multi Polygon Usage>>
83+
8084
* <<geo-point-usage,Geo Point Usage>>
8185

8286
* <<geo-polygon-usage,Geo Polygon Usage>>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/2.3
2+
3+
:github: https://github.com/elastic/elasticsearch-net
4+
5+
:nuget: https://www.nuget.org/packages
6+
7+
////
8+
IMPORTANT NOTE
9+
==============
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/2.x/src/Tests/QueryDsl/Geo/Shape/GeometryCollection/GeoGeometryCollectionUsageTests.cs.
11+
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
12+
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
13+
////
14+
15+
[[geo-geometry-collection-usage]]
16+
== Geo Geometry Collection Usage
17+
18+
=== Fluent DSL Example
19+
20+
[source,csharp]
21+
----
22+
q
23+
.GeoShapeGeometryCollection(c => c
24+
.Name("named_query")
25+
.Boost(1.1)
26+
.Field(p=>p.Location)
27+
.Geometries(
28+
new PointGeoShape(this._pointCoordinates),
29+
new MultiPointGeoShape(this._multiPointCoordinates),
30+
new LineStringGeoShape(this._lineStringCoordinates),
31+
new MultiLineStringGeoShape(this._multiLineStringCoordinates),
32+
new PolygonGeoShape(this._polygonCoordinates),
33+
new MultiPolygonGeoShape(this._multiPolygonCoordinates)
34+
)
35+
.Relation(GeoShapeRelation.Intersects)
36+
)
37+
----
38+
39+
=== Object Initializer Syntax Example
40+
41+
[source,csharp]
42+
----
43+
new GeoShapeGeometryCollectionQuery
44+
{
45+
Name = "named_query",
46+
Boost = 1.1,
47+
Field = Infer.Field<Project>(p=>p.Location),
48+
Shape = new Nest.GeometryCollection
49+
{
50+
Geometries = new IGeoShape[]
51+
{
52+
new PointGeoShape(this._pointCoordinates),
53+
new MultiPointGeoShape(this._multiPointCoordinates),
54+
new LineStringGeoShape(this._lineStringCoordinates),
55+
new MultiLineStringGeoShape(_multiLineStringCoordinates),
56+
new PolygonGeoShape(this._polygonCoordinates),
57+
new MultiPolygonGeoShape(this._multiPolygonCoordinates),
58+
}
59+
},
60+
Relation = GeoShapeRelation.Intersects
61+
}
62+
----
63+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/2.3
2+
3+
:github: https://github.com/elastic/elasticsearch-net
4+
5+
:nuget: https://www.nuget.org/packages
6+
7+
////
8+
IMPORTANT NOTE
9+
==============
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/2.x/src/Tests/QueryDsl/Geo/Shape/MultiPolygon/GeoMultiPolygonUsageTests.cs.
11+
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
12+
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
13+
////
14+
15+
[[geo-multi-polygon-usage]]
16+
== Geo Multi Polygon Usage
17+
18+
=== Fluent DSL Example
19+
20+
[source,csharp]
21+
----
22+
q
23+
.GeoShapeMultiPolygon(c => c
24+
.Name("named_query")
25+
.Boost(1.1)
26+
.Field(p => p.Location)
27+
.Coordinates(this._coordinates)
28+
.Relation(GeoShapeRelation.Intersects)
29+
)
30+
----
31+
32+
=== Object Initializer Syntax Example
33+
34+
[source,csharp]
35+
----
36+
new GeoShapeMultiPolygonQuery
37+
{
38+
Name = "named_query",
39+
Boost = 1.1,
40+
Field = Field<Project>(p => p.Location),
41+
Shape = new MultiPolygonGeoShape(this._coordinates),
42+
Relation = GeoShapeRelation.Intersects
43+
}
44+
----
45+

src/Nest/Indices/MappingManagement/PutMapping/PutMappingRequest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,13 @@ public PutMappingDescriptor<T> AutoMap(IPropertyVisitor visitor = null, int maxR
183183
/// <inheritdoc/>
184184
public PutMappingDescriptor<T> Parent<K>() where K : class => Assign(a => a.ParentField = new ParentField { Type = typeof(K) });
185185

186+
#pragma warning disable 618
186187
/// <inheritdoc/>
187188
public PutMappingDescriptor<T> Analyzer(string analyzer) => Assign(a => a.Analyzer = analyzer);
188189

189190
/// <inheritdoc/>
190191
public PutMappingDescriptor<T> SearchAnalyzer(string searchAnalyzer) => Assign(a => a.SearchAnalyzer = searchAnalyzer);
192+
#pragma warning restore 618
191193

192194
/// <inheritdoc/>
193195
public PutMappingDescriptor<T> AllField(Func<AllFieldDescriptor, IAllField> allFieldSelector) => Assign(a => a.AllField = allFieldSelector?.Invoke(new AllFieldDescriptor()));

src/Nest/Mapping/TypeMapping.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public interface ITypeMapping
5252
ISizeField SizeField { get; set; }
5353

5454
[JsonProperty("_timestamp")]
55-
[Obsolete("Use a normal date field and set its value explicitly")]
55+
[Obsolete("Deprecated. Use a normal date field and set its value explicitly")]
5656
ITimestampField TimestampField { get; set; }
5757

5858
[JsonProperty("_field_names")]
@@ -105,17 +105,17 @@ public class TypeMapping : ITypeMapping
105105
/// <inheritdoc/>
106106
public IRoutingField RoutingField { get; set; }
107107
/// <inheritdoc/>
108-
[Obsolete("Scheduled to be removed in 6.0. Default analyzers can no longer be specified at the type level. Use an index or field level analyzer instead.")]
108+
[Obsolete("Scheduled to be removed in 6.0.0. Default analyzers can no longer be specified at the type level. Use an index or field level analyzer instead.")]
109109
public string Analyzer { get; set; }
110110
/// <inheritdoc/>
111-
[Obsolete("Scheduled to be removed in 6.0. Default analyzers can no longer be specified at the type level. Use an index or field level analyzer instead.")]
111+
[Obsolete("Scheduled to be removed in 6.0.0. Default analyzers can no longer be specified at the type level. Use an index or field level analyzer instead.")]
112112
public string SearchAnalyzer { get; set; }
113113
/// <inheritdoc/>
114114
public ISizeField SizeField { get; set; }
115115
/// <inheritdoc/>
116116
public ISourceField SourceField { get; set; }
117117
/// <inheritdoc/>
118-
[Obsolete("Use a normal date field and set its value explicitly")]
118+
[Obsolete("Deprecated. Use a normal date field and set its value explicitly")]
119119
public ITimestampField TimestampField { get; set; }
120120
/// <inheritdoc/>
121121
[Obsolete("Deprecated in 2.0.0 Removed in 5.0.0")]
@@ -148,7 +148,7 @@ public class TypeMappingDescriptor<T> : DescriptorBase<TypeMappingDescriptor<T>,
148148
string ITypeMapping.SearchAnalyzer { get; set; }
149149
ISizeField ITypeMapping.SizeField { get; set; }
150150
ISourceField ITypeMapping.SourceField { get; set; }
151-
[Obsolete("Use a normal date field and set its value explicitly")]
151+
[Obsolete("Deprecated. Use a normal date field and set its value explicitly")]
152152
ITimestampField ITypeMapping.TimestampField { get; set; }
153153
[Obsolete("Deprecated in 2.0.0 Removed in 5.0.0")]
154154
IList<IMappingTransform> ITypeMapping.Transform { get; set; }
@@ -223,9 +223,8 @@ public TypeMappingDescriptor<T> AutoMap(IPropertyVisitor visitor = null, int max
223223
/// <inheritdoc/>
224224
public TypeMappingDescriptor<T> FieldNamesField(Func<FieldNamesFieldDescriptor<T>, IFieldNamesField> fieldNamesFieldSelector) => Assign(a => a.FieldNamesField = fieldNamesFieldSelector.Invoke(new FieldNamesFieldDescriptor<T>()));
225225

226-
#pragma warning disable 618
227226
/// <inheritdoc/>
228-
[Obsolete("Use a normal date field and set its value explicitly")]
227+
[Obsolete("Deprecated. Use a normal date field and set its value explicitly")]
229228
public TypeMappingDescriptor<T> TimestampField(Func<TimestampFieldDescriptor<T>, ITimestampField> timestampFieldSelector) => Assign(a => a.TimestampField = timestampFieldSelector?.Invoke(new TimestampFieldDescriptor<T>()));
230229

231230
/// <inheritdoc/>
@@ -240,7 +239,6 @@ public TypeMappingDescriptor<T> Transform(Func<MappingTransformsDescriptor, IPro
240239
/// <inheritdoc/>
241240
[Obsolete("Will be replaced with a different implementation in a future version of Elasticsearch")]
242241
public TypeMappingDescriptor<T> TtlField(Func<TtlFieldDescriptor, ITtlField> ttlFieldSelector) => Assign(a => a.TtlField = ttlFieldSelector?.Invoke(new TtlFieldDescriptor()));
243-
#pragma warning restore 618
244242

245243
/// <inheritdoc/>
246244
public TypeMappingDescriptor<T> Meta(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> metaSelector) => Assign(a => a.Meta = metaSelector(new FluentDictionary<string, object>()));

src/Nest/Nest.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,8 @@
10111011
<Compile Include="QueryDsl\Geo\Shape\Circle\GeoShapeCircleQuery.cs" />
10121012
<Compile Include="QueryDsl\Geo\Shape\Envelope\EnvelopeGeoShape.cs" />
10131013
<Compile Include="QueryDsl\Geo\Shape\Envelope\GeoShapeEnvelopeQuery.cs" />
1014+
<Compile Include="QueryDsl\Geo\Shape\GeometryCollection\GeometryCollection.cs" />
1015+
<Compile Include="QueryDsl\Geo\Shape\GeometryCollection\GeoShapeGeometryCollectionQuery.cs" />
10141016
<Compile Include="QueryDsl\Geo\Shape\GeoShapeBase.cs" />
10151017
<Compile Include="QueryDsl\Geo\Shape\GeoShapeQueryJsonConverter.cs" />
10161018
<Compile Include="QueryDsl\Geo\Shape\IGeoShapeQuery.cs" />

0 commit comments

Comments
 (0)