# Return polygons in a given point

**URL:** <https://discuss.elastic.co/t/return-polygons-in-a-given-point/141495>\
**Category:** Elasticsearch\
**Created:** [July 25, 2018, 6:21am UTC](https://discuss.elastic.co/t/return-polygons-in-a-given-point/141495 "2018-07-25T06:21:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ash\_Chamari](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Ash\_Chamari](https://discuss.elastic.co/u/Ash_Chamari)\
**Post date:** [July 25, 2018, 6:21am UTC](https://discuss.elastic.co/t/return-polygons-in-a-given-point/141495/1 "2018-07-25T06:21:05Z")

</div>

Hi,  
I am trying to return all the polygons in a given point.  
But my query returns all the docs in the index even if the given point doesn't falls in polygon 1, 2 & 3  
Index, docs and the query are given below

ref. [http://geojson.io/#map=7/-31.775/144.382](http://geojson.io/#map=7/-31.775/144.382)

PUT /example3  
{

"mappings": {  
"\_doc": {  
"properties": {  
"features": {  
"properties": {  
"geometry": {  
"type": "geo\_shape"

```
          }
        }
      }
    }
  }
}

```

}

POST /example3/\_doc?refresh  
{  
"type": "FeatureCollection",  
"features": [  
{  
"type": "Feature",  
"geometry": {  
"name": "Poly - 01",  
"type": "Polygon",  
"coordinates": [  
[  
[  
143.02001953125,  
-38.55246141354153  
],  
[  
146.162109375,  
-38.55246141354153  
],  
[  
146.162109375,  
-36.399178286076534  
],  
[  
143.02001953125,  
-36.399178286076534  
],  
[  
143.02001953125,  
-38.55246141354153  
]  
]  
]  
}  
},  
{  
"type": "Feature",  
"geometry": {  
"name": "Poly - 02",  
"type": "Polygon",  
"coordinates": [  
[  
[  
144.744873046875,  
-37.45741810262937  
],  
[  
147.7496337890625,  
-37.45741810262937  
],  
[  
147.7496337890625,  
-35.880148964883595  
],  
[  
144.744873046875,  
-35.880148964883595  
],  
[  
144.744873046875,  
-37.45741810262937  
]  
]  
]  
}  
},  
{  
"type": "Feature",  
"geometry": {  
"name": "Poly - 03",  
"type": "Polygon",  
"coordinates": [  
[  
[  
145.491943359375,  
-37.983174833513374  
],  
[  
146.97509765625,  
-37.983174833513374  
],  
[  
146.97509765625,  
-36.96306042436515  
],  
[  
145.491943359375,  
-36.96306042436515  
],  
[  
145.491943359375,  
-37.983174833513374  
]  
]  
]  
}  
},  
{  
"type": "Feature",  
"geometry": {  
"name": "Poly - 04",  
"type": "Polygon",  
"coordinates": [  
[  
[  
142.833251953125,  
-35.11990857099681  
],  
[  
147.3486328125,  
-35.11990857099681  
],  
[  
147.3486328125,  
-32.861132322810946  
],  
[  
142.833251953125,  
-32.861132322810946  
],  
[  
142.833251953125,  
-35.11990857099681  
]  
]  
]  
}  
},  
{  
"type": "Feature",  
"properties": {},  
"geometry": {  
"name": "Poly - 05",  
"type": "Polygon",  
"coordinates": [  
[  
[  
139.537353515625,  
-31.43803717312445  
],  
[  
140.504150390625,  
-31.43803717312445  
],  
[  
140.504150390625,  
-30.60954979719083  
],  
[  
139.537353515625,  
-30.60954979719083  
],  
[  
139.537353515625,  
-31.43803717312445  
]  
]  
]  
}  
}

```
]

```

}

GET /example3/\_search  
{  
"query":{  
"bool": {  
"must": {  
"match\_all": {}  
},  
"filter": {  
"geo\_shape": {  
"features.geometry": {  
"shape": {  
"type": "point",  
"coordinates" :  
[  
146.0138,  
-37.1734

```
                            ]
                        
                    }
                }
            }
        }
    }
}

```

}

---

<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:** [August 22, 2018, 6:21am UTC](https://discuss.elastic.co/t/return-polygons-in-a-given-point/141495/2 "2018-08-22T06:21:07Z")

</div>

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