# Geo\_shape index cannot convert by avro (nifi)

**URL:** <https://discuss.elastic.co/t/geo-shape-index-cannot-convert-by-avro-nifi/259064>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [December 18, 2020, 7:30am UTC](https://discuss.elastic.co/t/geo-shape-index-cannot-convert-by-avro-nifi/259064 "2020-12-18T07:30:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SenalChen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/senalchen/32/51490_2.png) [@SenalChen](https://discuss.elastic.co/u/SenalChen)\
**Post date:** [December 18, 2020, 7:30am UTC](https://discuss.elastic.co/t/geo-shape-index-cannot-convert-by-avro-nifi/259064/1 "2020-12-18T07:30:51Z")

</div>

I use json like this:  
`[{"scene_id":"LC81121092020347LGN00","data_path":112,"data_row":109,"upper_left_lon":95.20724,"upper_left_lat":-68.44105,"upper_right_lon":99.64702,"upper_right_lat":-69.16904,"lower_right_lon":97.65649,"lower_right_lat":-70.76711,"lower_left_lon":92.94828,"lower_left_lat":-69.98763,"ingestion_date":"2020-12-12","browser_url":"https://ims.cr.usgs.gov/browse/landsat_8_c1/2020/112/109/LC08_L1GT_112109_20201212_20201214_01_RT.jpg","sensor":"OLI_TIRS","product_id":"LC08_L1GT_112109_20201212_20201214_01_RT","geometry":"{\"coordinates\":[[[-177.0,10.0],[176.0,15.0],[172.0,0.0],[176.0,-15.0],[-177.0,-10.0],[-177.0,10.0]],[[178.2,8.2],[-178.8,8.2],[-180.8,-8.8],[178.2,8.8]]],\"type\":\"polygon\"}"}]`  
the "geometry" is a string.  
I want to index this json with mapping:

```auto
  ` {
    "mappings": {
        "data": {
            "properties": {
                "scene_id":{
                  "type" : "keyword",
                  "index" : false
                },
                "geometry": {
                    "type": "geo_shape"
                }
            }
        }
    }
}`

```

I used nifi professor and got the error:

 ![Snipaste_2020-12-18_15-27-04](https://us1.discourse-cdn.com/elastic/original/3X/a/9/a931f124370e0eb4bfaed20ea7a6644559f93d48.png)  
It's so hard with avro schema to solve this,pls help me.thank you!

---

<div class="post-metadata">

**Author:** ![Ignacio\_Vera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ignacio_vera/32/36674_2.png) [@Ignacio\_Vera](https://discuss.elastic.co/u/Ignacio_Vera)\
**Post date:** [December 18, 2020, 8:38am UTC](https://discuss.elastic.co/t/geo-shape-index-cannot-convert-by-avro-nifi/259064/2 "2020-12-18T08:38:51Z")

</div>

> [@SenalChen](#):
>
> "geometry": **"** {\"coordinates\":[[[-177.0,10.0],[176.0,15.0],[172.0,0.0],[176.0,-15.0],[-177.0,-10.0],[-177.0,10.0]],[[178.2,8.2],[-178.8,8.2],[-180.8,-8.8],[178.2,8.8]]],\"type\":\"polygon\"} **"** }

The problem is that your process is taking the generated geoJson and converting it to a string. I don't know much about Avro but you need to find a way so the GeoJSON is not treated as a String, or maybe try to generate WKT?

---

<div class="post-metadata">

**Author:** ![SenalChen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/senalchen/32/51490_2.png) [@SenalChen](https://discuss.elastic.co/u/SenalChen)\
**Post date:** [December 18, 2020, 10:24am UTC](https://discuss.elastic.co/t/geo-shape-index-cannot-convert-by-avro-nifi/259064/3 "2020-12-18T10:24:28Z")

</div>

Thank you for reply.I solved my problem with generate WKT.I trans it like:  
`POLYGON ((95.20724 -68.44105,99.64702 -69.16904,97.65649 -70.76711,92.94828 -69.98763,95.20724 -68.44105))`  
It work well,and the intersection is well done:  
`GET /landsat/_search { "query":{ "bool": { "must": { "match_all": {} }, "filter": { "geo_shape": { "geometry": { "shape": { "type": "polygon", "coordinates" : [[[96.0, -69.0],[96.0,-65.0],[97.0,-65.0],[97.0,-69],[96.0,-69.0]]] }, "relation": "INTERSECTS" } } } } } }`  
It's a good way for me.  
Thank you very much for the help!  
Have a good day!

---

<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:** [January 15, 2021, 10:24am UTC](https://discuss.elastic.co/t/geo-shape-index-cannot-convert-by-avro-nifi/259064/4 "2021-01-15T10:24:30Z")

</div>

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