# Multipolygon query

**URL:** <https://discuss.elastic.co/t/multipolygon-query/128131>\
**Category:** Elasticsearch\
**Created:** [April 16, 2018, 8:32am UTC](https://discuss.elastic.co/t/multipolygon-query/128131 "2018-04-16T08:32:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JanSp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jansp/32/27409_2.png) [@JanSp](https://discuss.elastic.co/u/JanSp)\
**Post date:** [April 16, 2018, 8:32am UTC](https://discuss.elastic.co/t/multipolygon-query/128131/1 "2018-04-16T08:32:11Z")

</div>

Hey guys,

i want to make a query on a multipolygon array and dont know if it is possible.

i have some tables where the coordinates stored as point and want to find all these document within a polygon or a multipolygon.

on a polygon it works like this example

```
[
                        "size" => 20,
                        "query" => [
                            "bool" => [
                                "must" => [
                                    "match_all" => (object)[]
                                ],
                                "filter" => [
                                    "geo_polygon" => [
                                        "location" => [
                                            "points" => $polygon
                                        ]
                                    ]
                                ]
                            ]

                        ]

```

but how to query if the $polygon array is an multipolygon?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 16, 2018, 8:23pm UTC](https://discuss.elastic.co/t/multipolygon-query/128131/2 "2018-04-16T20:23:15Z")

</div>

I don't think `geo_polygon` query supports multipolygons. You would have to either switch from `geo_point` type to `geo_shape` type and use `geo_shape` query create several `geo_polygon` queries yourself and combine them using a boolean query.

---

<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:** [May 14, 2018, 8:23pm UTC](https://discuss.elastic.co/t/multipolygon-query/128131/3 "2018-05-14T20:23:17Z")

</div>

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