NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Geo Shape Polygon Query Usageedit
Fluent DSL exampleedit
q .GeoShapePolygon(c => c .Name("named_query") .Boost(1.1) .Field(p => p.LocationShape) .Coordinates(PolygonCoordinates) .Relation(GeoShapeRelation.Intersects) .IgnoreUnmapped(true) )
Object Initializer syntax exampleedit
new GeoShapePolygonQuery { Name = "named_query", Boost = 1.1, Field = Field<Project>(p => p.LocationShape), Shape = new PolygonGeoShape(PolygonCoordinates), Relation = GeoShapeRelation.Intersects, IgnoreUnmapped = true }
Example json output.
{ "geo_shape": { "_name": "named_query", "boost": 1.1, "ignore_unmapped": true, "locationShape": { "relation": "intersects", "shape": { "type": "polygon", "coordinates": [ [ [ 10.0, -17.0 ], [ 15.0, 16.0 ], [ 0.0, 12.0 ], [ -15.0, 16.0 ], [ -10.0, -17.0 ], [ 10.0, -17.0 ] ], [ [ 8.2, 18.2 ], [ 8.2, -18.8 ], [ -8.8, -10.8 ], [ 8.8, 18.2 ] ] ] } } } }