0
votes

I have following error in Elasticsearch

Error

{Type: illegal_argument_exception Reason: "top is below bottom corner: 41.27072281070173 vs. 69.22146114208326"}

my code is

var Buildingpoints= _elasticClient.Search<ElasticSearchModel>(
                     s => s.From(0).Size(600).Query(query => query.Bool(b => b
                     .Filter(filter => filter
                    .GeoBoundingBox(g => g
                    .Boost(1.1)
                    .Name("Location")
                    .Field(p => p.Location)
                    .BoundingBox(c => c
                    .TopLeft(model.Points.X1, model.Points.Y1)
                    .BottomRight(model.Points.X2, model.Points.Y2)
                     )
                    .ValidationMethod(GeoValidationMethod.Strict)
                    .Type(GeoExecution.Indexed)
                    )
                    )


                        )
               ));

I am new in elastic search, help me to solve this problem. ERROR "{ServerError: 400Type: search_phase_execution_exception Reason: "all shards failed"}" enter image description here

1

1 Answers

1
votes

Elasticsearch is just telling you that bounding box corners constraint is not met. Bottom corner needs to be "below" top corner.

Replacing

.TopLeft(model.Points.X1, model.Points.Y1)
.BottomRight(model.Points.X2, model.Points.Y2)

with

.TopLeft(model.Points.X2, model.Points.Y2)
.BottomRight(model.Points.X1, model.Points.Y1)

should do the job here.