Geo Shape Polygon Query Usageedit

Fluent DSL exampleedit

q
.GeoShapePolygon(c => c
    .Name("named_query")
    .Boost(1.1)
    .Field(p => p.Location)
    .Coordinates(this._polygonCoordinates)
    .Relation(GeoShapeRelation.Intersects)
    .IgnoreUnmapped(true)
)

Object Initializer syntax exampleedit

new GeoShapePolygonQuery
{
    Name = "named_query",
    Boost = 1.1,
    Field = Field<Project>(p => p.Location),
    Shape = new PolygonGeoShape(this._polygonCoordinates),
    Relation = GeoShapeRelation.Intersects,
    IgnoreUnmapped = true
}

Example json output. 

{
  "geo_shape": {
    "_name": "named_query",
    "boost": 1.1,
    "ignore_unmapped": true,
    "location": {
      "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
            ]
          ]
        ]
      }
    }
  }
}