Skip to content

Commit 79003da

Browse files
committed
Integration tests and docs for circle and multipoint geoshape queries
Relates: elastic/elasticsearch#53466, elastic/elasticsearch#52564 elastic/elasticsearch#53466, elastic/elasticsearch#52133 This commit updates the Skip versions on circle and multipoint geoshape queries, to allow them to run for versions 7.7.0+. Update documentation to indicate that 7.7.0+ is required when geo shapes are indexed using BKD trees
1 parent 33826ed commit 79003da

File tree

4 files changed

+274
-25
lines changed

4 files changed

+274
-25
lines changed

docs/query-dsl/geo/geo-shape/geo-shape-query-usage.asciidoc

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,69 @@ new GeoShapeQuery
7979
}
8080
----
8181

82+
[[geo-shape-query-multipoint]]
83+
[float]
84+
== Querying with MultiPoint
85+
86+
NOTE: Elasticsearch 7.7.0+ required when MultiPoint is indexed using BKD trees (the default).
87+
88+
==== Fluent DSL example
89+
90+
[source,csharp]
91+
----
92+
q
93+
.GeoShape(c => c
94+
.Name("named_query")
95+
.Boost(1.1)
96+
.Field(p => p.LocationShape)
97+
.Shape(s => s
98+
.MultiPoint(MultiPointCoordinates)
99+
)
100+
.Relation(GeoShapeRelation.Intersects)
101+
)
102+
----
103+
104+
==== Object Initializer syntax example
105+
106+
[source,csharp]
107+
----
108+
new GeoShapeQuery
109+
{
110+
Name = "named_query",
111+
Boost = 1.1,
112+
Field = Infer.Field<Project>(p => p.LocationShape),
113+
Shape = new MultiPointGeoShape(MultiPointCoordinates),
114+
Relation = GeoShapeRelation.Intersects,
115+
}
116+
----
117+
118+
[source,javascript]
119+
.Example json output
120+
----
121+
{
122+
"geo_shape": {
123+
"_name": "named_query",
124+
"boost": 1.1,
125+
"locationShape": {
126+
"relation": "intersects",
127+
"shape": {
128+
"type": "multipoint",
129+
"coordinates": [
130+
[
131+
38.897676,
132+
-77.03653
133+
],
134+
[
135+
38.889939,
136+
-77.009051
137+
]
138+
]
139+
}
140+
}
141+
}
142+
}
143+
----
144+
82145
[[geo-shape-query-linestring]]
83146
[float]
84147
== Querying with LineString
@@ -823,6 +886,64 @@ new GeoShapeQuery
823886
}
824887
----
825888

889+
[[geo-shape-query-circle]]
890+
[float]
891+
== Querying with Circle
892+
893+
NOTE: Available in Elasticsearch 7.7.0+
894+
895+
==== Fluent DSL example
896+
897+
[source,csharp]
898+
----
899+
q
900+
.GeoShape(c => c
901+
.Name("named_query")
902+
.Boost(1.1)
903+
.Field(p => p.LocationShape)
904+
.Shape(s => s
905+
.Circle(CircleCoordinates, "100m")
906+
)
907+
.Relation(GeoShapeRelation.Intersects)
908+
)
909+
----
910+
911+
==== Object Initializer syntax example
912+
913+
[source,csharp]
914+
----
915+
new GeoShapeQuery
916+
{
917+
Name = "named_query",
918+
Boost = 1.1,
919+
Field = Infer.Field<Project>(p => p.LocationShape),
920+
Shape = new CircleGeoShape(CircleCoordinates, "100m"),
921+
Relation = GeoShapeRelation.Intersects,
922+
}
923+
----
924+
925+
[source,javascript]
926+
.Example json output
927+
----
928+
{
929+
"geo_shape": {
930+
"_name": "named_query",
931+
"boost": 1.1,
932+
"locationShape": {
933+
"relation": "intersects",
934+
"shape": {
935+
"type": "circle",
936+
"radius": "100m",
937+
"coordinates": [
938+
45.0,
939+
-45.0
940+
]
941+
}
942+
}
943+
}
944+
}
945+
----
946+
826947
[[geo-shape-query-indexedshape]]
827948
[float]
828949
== Querying with an indexed shape

docs/query-dsl/specialized/shape/shape-query-usage.asciidoc

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,69 @@ new ShapeQuery
7676
}
7777
----
7878

79+
[[shape-query-multipoint]]
80+
[float]
81+
== Querying with MultiPoint
82+
83+
NOTE: Elasticsearch 7.7.0+ required when MultiPoint is indexed using BKD trees (the default).
84+
85+
==== Fluent DSL example
86+
87+
[source,csharp]
88+
----
89+
q
90+
.Shape(c => c
91+
.Name("named_query")
92+
.Boost(1.1)
93+
.Field(p => p.ArbitraryShape)
94+
.Shape(s => s
95+
.MultiPoint(MultiPointCoordinates)
96+
)
97+
.Relation(ShapeRelation.Intersects)
98+
)
99+
----
100+
101+
==== Object Initializer syntax example
102+
103+
[source,csharp]
104+
----
105+
new ShapeQuery
106+
{
107+
Name = "named_query",
108+
Boost = 1.1,
109+
Field = Infer.Field<Project>(p => p.ArbitraryShape),
110+
Shape = new MultiPointGeoShape(MultiPointCoordinates),
111+
Relation = ShapeRelation.Intersects,
112+
}
113+
----
114+
115+
[source,javascript]
116+
.Example json output
117+
----
118+
{
119+
"shape": {
120+
"_name": "named_query",
121+
"boost": 1.1,
122+
"arbitraryShape": {
123+
"relation": "intersects",
124+
"shape": {
125+
"type": "multipoint",
126+
"coordinates": [
127+
[
128+
38.897676,
129+
-77.03653
130+
],
131+
[
132+
38.889939,
133+
-77.009051
134+
]
135+
]
136+
}
137+
}
138+
}
139+
}
140+
----
141+
79142
[[shape-query-linestring]]
80143
[float]
81144
== Querying with LineString
@@ -820,6 +883,64 @@ new ShapeQuery
820883
}
821884
----
822885

886+
[[shape-query-circle]]
887+
[float]
888+
== Querying with Circle
889+
890+
NOTE: Available in Elasticsearch 7.7.0+
891+
892+
==== Fluent DSL example
893+
894+
[source,csharp]
895+
----
896+
q
897+
.Shape(c => c
898+
.Name("named_query")
899+
.Boost(1.1)
900+
.Field(p => p.ArbitraryShape)
901+
.Shape(s => s
902+
.Circle(CircleCoordinates, "100m")
903+
)
904+
.Relation(ShapeRelation.Intersects)
905+
)
906+
----
907+
908+
==== Object Initializer syntax example
909+
910+
[source,csharp]
911+
----
912+
new ShapeQuery
913+
{
914+
Name = "named_query",
915+
Boost = 1.1,
916+
Field = Infer.Field<Project>(p => p.ArbitraryShape),
917+
Shape = new CircleGeoShape(CircleCoordinates, "100m"),
918+
Relation = ShapeRelation.Intersects,
919+
}
920+
----
921+
922+
[source,javascript]
923+
.Example json output
924+
----
925+
{
926+
"shape": {
927+
"_name": "named_query",
928+
"boost": 1.1,
929+
"arbitraryShape": {
930+
"relation": "intersects",
931+
"shape": {
932+
"type": "circle",
933+
"radius": "100m",
934+
"coordinates": [
935+
45.0,
936+
-45.0
937+
]
938+
}
939+
}
940+
}
941+
}
942+
----
943+
823944
[[shape-query-indexedshape]]
824945
[float]
825946
== Querying with an indexed shape

0 commit comments

Comments
 (0)