# Read geo\_shape in native script

**URL:** https://discuss.elastic.co/t/read-geo-shape-in-native-script/54212
**Category:** Elasticsearch
**Created:** [June 28, 2016, 10:34pm UTC](https://discuss.elastic.co/t/read-geo-shape-in-native-script/54212 "2016-06-28T22:34:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![norbert](https://avatars.discourse-cdn.com/v4/letter/n/f6c823/32.png) [@norbert](https://discuss.elastic.co/u/norbert)
#### Post date: [June 28, 2016, 10:34pm UTC](https://discuss.elastic.co/t/read-geo-shape-in-native-script/54212/1 "2016-06-28T22:34:29Z")

</div>

How can I read the value of a geo\_shape field in a native script back into a JTS Shape?

I've tried doc().get("geometry") which throws a "failed to find field data builder for field geometry, and type geo\_shape" error.

Also tried the following:  
val raw = source().extractValue("geometry").toString  
val parser = XContentType.JSON.xContent.createParser(raw)  
val shape = GeoShapeType.parse(parser).build() //throws "shape must be an object consisting of type and coordinates"

I could import another GeoJSON parser (geotools) and parse the "raw" value, but it seems like there would be a way using the provided components.

---

<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: [July 5, 2017, 10:39pm UTC](https://discuss.elastic.co/t/read-geo-shape-in-native-script/54212/2 "2017-07-05T22:39:49Z")

</div>


