Finding a geo point inside a geoshape rectangle

Ohhhhhh I see... YAY!!!!!

@Ignacio_Vera It is weird the malformed envelopes still show up on the map... and still ingest ... seems like some validation is in order :wink:

But now it Works when I define the envelopes correct!!!

@antonpious You should be able to do this..

DELETE discuss-shape

PUT discuss-shape/
{
  "mappings": {
    "properties": {
      "name" : {"type": "keyword"},
      "geoLocationBox": {"type": "geo_shape"}
    }
  }
}

POST discuss-shape/_doc
{
  "name": "10x10 Box Other",
  "geoLocationBox": {
    "type": "envelope",
    "coordinates": [
      [
        -10.0,
        10.0
      ],
      [
        10.0,
        -10.0
      ]
    ]
  }
}

POST discuss-shape/_doc
{
  "name": "5x5 Box",
  "geoLocationBox": {
    "type": "envelope",
    "coordinates": [
      [
        -5.0,
        5.0
      ],
      [
        5.0,
        -5.0
      ]
    ]
  }
}

POST discuss-shape/_doc
{
  "name": "5x5 Offset Box",
  "geoLocationBox": {
    "type": "envelope",
    "coordinates": [
      [
        5.0,
        10.0
      ],
      [
        10.0,
        5.0
      ]
    ]
  }
}

POST discuss-shape/_search
{
  "query": {
    "geo_shape": {
      "geoLocationBox": {
        "relation": "intersects",
        "shape": {
          "coordinates": [ 0.0, 0.0 ],
          "type": "point"
        }
      }
    }
  }
}

# Correct Results!!!

{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 2,
      "relation": "eq"
    },
    "max_score": 0,
    "hits": [
      {
        "_index": "discuss-shape",
        "_id": "8HoK-YMBWq97sHQ4avvA",
        "_score": 0,
        "_source": {
          "name": "10x10 Box Other",
          "geoLocationBox": {
            "type": "envelope",
            "coordinates": [
              [
                -10,
                10
              ],
              [
                10,
                -10
              ]
            ]
          }
        }
      },
      {
        "_index": "discuss-shape",
        "_id": "anoM-YMBWq97sHQ4dv38",
        "_score": 0,
        "_source": {
          "name": "5x5 Box",
          "geoLocationBox": {
            "type": "envelope",
            "coordinates": [
              [
                -5,
                5
              ],
              [
                5,
                -5
              ]
            ]
          }
        }
      }
    ]
  }
}

I KNEW we did this!!! :slight_smile: