# FeatureCollection to geo\_shape

**URL:** https://discuss.elastic.co/t/featurecollection-to-geo-shape/143334
**Category:** Elasticsearch
**Created:** [August 7, 2018, 1:16pm UTC](https://discuss.elastic.co/t/featurecollection-to-geo-shape/143334 "2018-08-07T13:16:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yannick-cw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yannick-cw/32/34220_2.png) [@yannick-cw](https://discuss.elastic.co/u/yannick-cw)
#### Post date: [August 7, 2018, 1:16pm UTC](https://discuss.elastic.co/t/featurecollection-to-geo-shape/143334/1 "2018-08-07T13:16:11Z")

</div>

#### Whats the right way to translate a geojson FeatureCollection to a es geo\_shape?

I have a FeatureCollection looking like this:

```auto
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [[[1.96, 42.455],[1.985,42.445]]]
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [...]
      }
    }
  ]
}

```

How can I translate this into the es `geo_shape`.  
Currently I just index it like that (dropping `type: Feature` and `type: FeatureCollection` fields) and add a mapping saying:

```auto
"features": {
    "geometry": {
      "type": "geo_shape"
    }
}

```

This seems to work fine, but feels wrong, as I give an array of `geometry`s.  
Is this okay or would the right way be to translate the `FeatureCollection` to type `geometrycollection`? Which clearly wants multiple `geometry` elements.

One Followup question, can I do a query a la: `Give me all elements geometrically inside Element X` in one query, without fetching X and than doing multiple follow up queries for each polygon?

---

<div class="post-metadata">

### Author: ![yannick-cw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yannick-cw/32/34220_2.png) [@yannick-cw](https://discuss.elastic.co/u/yannick-cw)
#### Post date: [August 10, 2018, 9:17am UTC](https://discuss.elastic.co/t/featurecollection-to-geo-shape/143334/2 "2018-08-10T09:17:51Z")

</div>

So I just tried indexing once as `geometrycollection` and once as list of polygons as the example above. Both produce same search results for different queries, so is that just equivalent or can I produce different behavior somehow?

---

<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: [September 7, 2018, 9:22am UTC](https://discuss.elastic.co/t/featurecollection-to-geo-shape/143334/3 "2018-09-07T09:22:44Z")

</div>

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