# Query for specific geo\_shape types

**URL:** <https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671>\
**Category:** Elasticsearch\
**Created:** [May 4, 2018, 6:22pm UTC](https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671 "2018-05-04T18:22:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Hudson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brian_hudson/32/1306_2.png) [@Brian\_Hudson](https://discuss.elastic.co/u/Brian_Hudson)\
**Post date:** [May 4, 2018, 6:22pm UTC](https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671/1 "2018-05-04T18:22:10Z")

</div>

Is it possible to query a geo\_shape field for shapes of a particular type?

---

<div class="post-metadata">

**Author:** ![Glen\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glen_smith/32/111656_2.png) [@Glen\_Smith](https://discuss.elastic.co/u/Glen_Smith)\
**Post date:** [May 5, 2018, 4:19am UTC](https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671/2 "2018-05-05T04:19:22Z")

</div>

Can you clarify what you mean by `type`? `geo_shape` _is_ the type.

---

<div class="post-metadata">

**Author:** ![Brian\_Hudson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brian_hudson/32/1306_2.png) [@Brian\_Hudson](https://discuss.elastic.co/u/Brian_Hudson)\
**Post date:** [May 5, 2018, 1:23pm UTC](https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671/3 "2018-05-05T13:23:14Z")

</div>

Sorry, I meant by the GeoJSON type. I have a geo\_shape field, where some documents contain a LineString and others a Polygon. I'd like to be able to query for all documents which have a Polygon geo\_shape indexed in that field.

I don't think there is a way to do so, and I'll have to change my mapping around and reindex to support this.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [May 6, 2018, 5:42pm UTC](https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671/4 "2018-05-06T17:42:43Z")

</div>

You'll need to index the type of `geo_shape` into a separate `keyword` field; it's not queryable on the `geo_shape` field itself as far as I am aware.

---

<div class="post-metadata">

**Author:** ![Brian\_Hudson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brian_hudson/32/1306_2.png) [@Brian\_Hudson](https://discuss.elastic.co/u/Brian_Hudson)\
**Post date:** [May 7, 2018, 11:49am UTC](https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671/5 "2018-05-07T11:49:30Z")

</div>

Yeah that's what I was thinking too.

Maybe I'll write up a feature request for making the GeoJSON type queryable, I think it could be useful.

---

<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:** [June 4, 2018, 11:52am UTC](https://discuss.elastic.co/t/query-for-specific-geo-shape-types/130671/6 "2018-06-04T11:52:46Z")

</div>

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