# Polygon geo\_shape filter error question InvalidShapeException\[Self-intersection at or near point

**URL:** https://discuss.elastic.co/t/polygon-geo-shape-filter-error-question-invalidshapeexception-self-intersection-at-or-near-point/102781
**Category:** Elasticsearch
**Created:** [October 5, 2017, 1:18am UTC](https://discuss.elastic.co/t/polygon-geo-shape-filter-error-question-invalidshapeexception-self-intersection-at-or-near-point/102781 "2017-10-05T01:18:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Richard\_Scott](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Scott](https://discuss.elastic.co/u/Richard_Scott)
#### Post date: [October 5, 2017, 1:18am UTC](https://discuss.elastic.co/t/polygon-geo-shape-filter-error-question-invalidshapeexception-self-intersection-at-or-near-point/102781/1 "2017-10-05T01:18:31Z")

</div>

Hi,

I have been trying to use a polygon query. Elasticsearch 1.5 on AWS. The mapping is :-  
Mappings  
customer  
shiptostring  
sitegeo\_shape

```
client.search({
index: 'ramcar',
type: 'customer',
body: {
    "query":{
        "filtered": {
            "query": {
                "match_all": {}
            },
            "filter": {
                "geo_shape": {
                    "site": {
                        "shape": {
                            "type": "polygon",
                            "coordinates" : 
                                    coordinatespoly
                        }
                    }
                }
            }
        }
    } //end query
}

```

The query works fine for somethings, but I want to query a whole bunch of shapes like :-

```
coordinatespoly = [[151.211172866184,-33.9138219602477],[151.212255333816,-33.9129236397523],[151.211172866184,-33.9138219602477],[151.212255333816,-33.9138219602477],[151.211172866184,-33.9138219602477]]

```

I tried a simpler version 👎

```
coordsnoh3 = [[[151.211, -33.914], [151.211, -33.913], [151.212, -33.914], [151.212, -33.913], [151.211, -33.914] ]] 

 <- 400

```

{  
"error": "SearchPhaseExecutionException[Failed to execute phase [query\_fetch], all shards failed; shardFailures {[J-6qXpSMRmi9wsfjgmkzPA][ramcar][0]:SearchParseException[[ramcar][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"filtered":{"query":{"match\_all":{}},"filter":{"geo\_shape":{"site":{"shape":{"type":"polygon","coordinates":[[[151.211,-33.914],[151.211,-33.913],[151.212,-33.914],[151.212,-33.913],[151.211,-33.914]]]}}}}}}}]]]; nested: InvalidShapeException[Self-intersection at or near point (151.2115, -33.9135, NaN)]; }]",  
"status": 400  
}

whereas 👎  
coordsnoh2 = [[[150.0, -34], [150.0, -33], [151.0, -33], [151.0, -34], [150.0, -34] ]]

works fine

thanks for any advice,

Richard

---

<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: [November 2, 2017, 1:18am UTC](https://discuss.elastic.co/t/polygon-geo-shape-filter-error-question-invalidshapeexception-self-intersection-at-or-near-point/102781/2 "2017-11-02T01:18:33Z")

</div>

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