0

I am trying to get the following Elastic query filter working by using Nest client

{
  "geo_shape" : {
  "SitePoint" : {
    "shape" : {
     "type" : "polygon",
     "orientation" : "right",
     "coordinates" : [
       [
         [
           -99.8299313,
           32.2840118
         ],
         [
           -99.8293304,
           32.2840118
         ],
         ................
         ................

    },
    "relation" : "within"
  },
  "ignore_unmapped" : false,
  "boost" : 1.0
 }
}

This is how I have it using Nest version 6

await Client.SearchAsync<Sites>(s => s
        .Index("site_search")
        .Size(10_000)
        .AllTypes()
        .Query(q => q
            .Bool(b => b
                .Must(m => m
                        .QueryString(qs => qs
                            .DefaultField("_all")
                            .Query("Id:" + Id)
                        )
                    )
                .Filter(f => f
                    .GeoShapePolygon(
                                po => new GeoShapePolygonQuery
                                {
                                    Boost = 1.0,
                                    Field = "SitePoint",                                        
                                    Shape = new PolygonGeoShape(coords),
                                    Relation = GeoShapeRelation.Within,
                                    IgnoreUnmapped = true
                                }
                        )
                    )
                )
            ))).Documents;

The query is meant to filter the number of sites returned. However it returns the following error

ServerError: Type: parse_exception Reason: "invalid number of points in LinearRing (found [1] - must be >= [4])"

Not sure if I am doing anything wrong?

KJSR
  • 1,679
  • 6
  • 28
  • 51

0 Answers0