# Point in Polygon without CONTAINS spatial relation operator (now DEPRECATED)

**URL:** https://discuss.elastic.co/t/point-in-polygon-without-contains-spatial-relation-operator-now-deprecated/209379
**Category:** Elasticsearch
**Created:** [November 25, 2019, 9:09pm UTC](https://discuss.elastic.co/t/point-in-polygon-without-contains-spatial-relation-operator-now-deprecated/209379 "2019-11-25T21:09:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![krsarmiento](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krsarmiento/32/58314_2.png) [@krsarmiento](https://discuss.elastic.co/u/krsarmiento)
#### Post date: [November 25, 2019, 9:09pm UTC](https://discuss.elastic.co/t/point-in-polygon-without-contains-spatial-relation-operator-now-deprecated/209379/1 "2019-11-25T21:09:10Z")

</div>

**TL;DR** : _ **geo\_shape**** CONTAINS** operation is deprecated and I don't see an equivalent in the docs. I'm trying to find all the polygons that contain a coordinate point._

I worked with Polygon indexation and PIP (Point in Polygon) operations. **To find all polygons that contained a given coordinate (point)** we used this query:

```auto
query["query"]["bool"]["filter"] = {
    "geo_shape": {
        "location": {
            "shape": {
                "type": "point",
                "coordinates" : [longitude, latitude]
            },
            "relation": "contains"
        }
    }
}

```

I'm currently working in a new project that does something similar, so I decided to use the same query but it turns out that this relation has been deprecated. Reading the docs does not help so I decided to do some testing with a small subset of our current data (it's a large dataset) and **intersects** seems to be working well.

```auto
query["query"]["bool"]["filter"] = {
    "geo_shape": {
        "location": {
            "shape": {
                "type": "point",
                "coordinates" : [longitude, latitude]
            },
            "relation": "intersects"
        }
    }
}

```

Now, can **intersects** and **contains** be considered equivalent from a **Point in Polygon** point of view?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 23, 2019, 9:23pm UTC](https://discuss.elastic.co/t/point-in-polygon-without-contains-spatial-relation-operator-now-deprecated/209379/2 "2019-12-23T21:23:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
