Skip to content
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

Integration tests and docs for circle and multipoint geoshape queries #4601

Merged
merged 1 commit into from
Apr 17, 2020
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
121 changes: 121 additions & 0 deletions docs/query-dsl/geo/geo-shape/geo-shape-query-usage.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,69 @@ new GeoShapeQuery
}
----

[[geo-shape-query-multipoint]]
[float]
== Querying with MultiPoint

NOTE: Elasticsearch 7.7.0+ required when MultiPoint is indexed using BKD trees (the default).

==== Fluent DSL example

[source,csharp]
----
q
.GeoShape(c => c
.Name("named_query")
.Boost(1.1)
.Field(p => p.LocationShape)
.Shape(s => s
.MultiPoint(MultiPointCoordinates)
)
.Relation(GeoShapeRelation.Intersects)
)
----

==== Object Initializer syntax example

[source,csharp]
----
new GeoShapeQuery
{
Name = "named_query",
Boost = 1.1,
Field = Infer.Field<Project>(p => p.LocationShape),
Shape = new MultiPointGeoShape(MultiPointCoordinates),
Relation = GeoShapeRelation.Intersects,
}
----

[source,javascript]
.Example json output
----
{
"geo_shape": {
"_name": "named_query",
"boost": 1.1,
"locationShape": {
"relation": "intersects",
"shape": {
"type": "multipoint",
"coordinates": [
[
38.897676,
-77.03653
],
[
38.889939,
-77.009051
]
]
}
}
}
}
----

[[geo-shape-query-linestring]]
[float]
== Querying with LineString
Expand Down Expand Up @@ -823,6 +886,64 @@ new GeoShapeQuery
}
----

[[geo-shape-query-circle]]
[float]
== Querying with Circle

NOTE: Available in Elasticsearch 7.7.0+

==== Fluent DSL example

[source,csharp]
----
q
.GeoShape(c => c
.Name("named_query")
.Boost(1.1)
.Field(p => p.LocationShape)
.Shape(s => s
.Circle(CircleCoordinates, "100m")
)
.Relation(GeoShapeRelation.Intersects)
)
----

==== Object Initializer syntax example

[source,csharp]
----
new GeoShapeQuery
{
Name = "named_query",
Boost = 1.1,
Field = Infer.Field<Project>(p => p.LocationShape),
Shape = new CircleGeoShape(CircleCoordinates, "100m"),
Relation = GeoShapeRelation.Intersects,
}
----

[source,javascript]
.Example json output
----
{
"geo_shape": {
"_name": "named_query",
"boost": 1.1,
"locationShape": {
"relation": "intersects",
"shape": {
"type": "circle",
"radius": "100m",
"coordinates": [
45.0,
-45.0
]
}
}
}
}
----

[[geo-shape-query-indexedshape]]
[float]
== Querying with an indexed shape
Expand Down
121 changes: 121 additions & 0 deletions docs/query-dsl/specialized/shape/shape-query-usage.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,69 @@ new ShapeQuery
}
----

[[shape-query-multipoint]]
[float]
== Querying with MultiPoint

NOTE: Elasticsearch 7.7.0+ required when MultiPoint is indexed using BKD trees (the default).

==== Fluent DSL example

[source,csharp]
----
q
.Shape(c => c
.Name("named_query")
.Boost(1.1)
.Field(p => p.ArbitraryShape)
.Shape(s => s
.MultiPoint(MultiPointCoordinates)
)
.Relation(ShapeRelation.Intersects)
)
----

==== Object Initializer syntax example

[source,csharp]
----
new ShapeQuery
{
Name = "named_query",
Boost = 1.1,
Field = Infer.Field<Project>(p => p.ArbitraryShape),
Shape = new MultiPointGeoShape(MultiPointCoordinates),
Relation = ShapeRelation.Intersects,
}
----

[source,javascript]
.Example json output
----
{
"shape": {
"_name": "named_query",
"boost": 1.1,
"arbitraryShape": {
"relation": "intersects",
"shape": {
"type": "multipoint",
"coordinates": [
[
38.897676,
-77.03653
],
[
38.889939,
-77.009051
]
]
}
}
}
}
----

[[shape-query-linestring]]
[float]
== Querying with LineString
Expand Down Expand Up @@ -820,6 +883,64 @@ new ShapeQuery
}
----

[[shape-query-circle]]
[float]
== Querying with Circle

NOTE: Available in Elasticsearch 7.7.0+

==== Fluent DSL example

[source,csharp]
----
q
.Shape(c => c
.Name("named_query")
.Boost(1.1)
.Field(p => p.ArbitraryShape)
.Shape(s => s
.Circle(CircleCoordinates, "100m")
)
.Relation(ShapeRelation.Intersects)
)
----

==== Object Initializer syntax example

[source,csharp]
----
new ShapeQuery
{
Name = "named_query",
Boost = 1.1,
Field = Infer.Field<Project>(p => p.ArbitraryShape),
Shape = new CircleGeoShape(CircleCoordinates, "100m"),
Relation = ShapeRelation.Intersects,
}
----

[source,javascript]
.Example json output
----
{
"shape": {
"_name": "named_query",
"boost": 1.1,
"arbitraryShape": {
"relation": "intersects",
"shape": {
"type": "circle",
"radius": "100m",
"coordinates": [
45.0,
-45.0
]
}
}
}
}
----

[[shape-query-indexedshape]]
[float]
== Querying with an indexed shape
Expand Down
Loading