# CIRCLE geometry is not supported

**URL:** <https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093>\
**Category:** Elasticsearch\
**Created:** [March 6, 2019, 11:11am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093 "2019-03-06T11:11:07Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amjad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Amjad\_Khan](https://discuss.elastic.co/u/Amjad_Khan)\
**Post date:** [March 6, 2019, 11:11am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/1 "2019-03-06T11:11:07Z")

</div>

HELLO ,  
I was using elasticsearch 6.1 before and i was able to query geo\_shape LINESTRING using circle intersects . recently updated to 6.6 and unable to query the Same , How do I search for line string which is near to a point , below is my query  
GET way/\_search  
{

"query":  
{  
"bool": {  
"must":  
{  
"match\_all":{}  
}  
,"filter": {

```
    "geo_shape": {
      "geometry": {
        "shape": {
          "type": "circle",
          "coordinates": [25.292679,55.4118288],
          "radius":10
        }
      }
    }
  }
}

```

}  
}

it gives error like below,  
{  
"error": {  
"root\_cause": [  
{  
"type": "query\_shard\_exception",  
"reason": "failed to create query: {\n "bool" : {\n "must" : [\n {\n "match\_all" : {\n "boost" : 1.0\n }\n }\n],\n "filter" : [\n {\n "geo\_shape" : {\n "geometry" : {\n "shape" : {\n "type" : "circle",\n "radius" : "10.0m",\n "coordinates" : [\n 25.292679,\n 55.4118288\n]\n },\n "relation" : "intersects"\n },\n "ignore\_unmapped" : false,\n "boost" : 1.0\n }\n }\n ],\n "adjust\_pure\_negative" : true,\n "boost" : 1.0\n }\n}",  
"index\_uuid": "7kFB6PsbR0CPtnXsgOLO6Q",  
"index": "way"  
}  
],  
"type": "search\_phase\_execution\_exception",  
"reason": "all shards failed",  
"phase": "query",  
"grouped": true,  
"failed\_shards": [  
{  
"shard": 0,  
"index": "way",  
"node": "7x3HJTAjSPukxRwfrtuLZQ",  
"reason": {  
"type": "query\_shard\_exception",  
"reason": "failed to create query: {\n "bool" : {\n "must" : [\n {\n "match\_all" : {\n "boost" : 1.0\n }\n }\n],\n "filter" : [\n {\n "geo\_shape" : {\n "geometry" : {\n "shape" : {\n "type" : "circle",\n "radius" : "10.0m",\n "coordinates" : [\n 25.292679,\n 55.4118288\n]\n },\n "relation" : "intersects"\n },\n "ignore\_unmapped" : false,\n "boost" : 1.0\n }\n }\n ],\n "adjust\_pure\_negative" : true,\n "boost" : 1.0\n }\n}",  
"index\_uuid": "7kFB6PsbR0CPtnXsgOLO6Q",  
"index": "way",  
"caused\_by": {  
"type": "unsupported\_operation\_exception",  
"reason": "CIRCLE geometry is not supported"  
}  
}  
}  
]  
},  
"status": 400  
}

what will be the solution , i cannot see any doc says this CIRCLE SEARCH is obsolute.

Please help,

---

<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:** [March 6, 2019, 2:47pm UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/2 "2019-03-06T14:47:17Z")

</div>

Which version are you using, 6.6.0 or 6.6.1?

Could you share as well your current geo\_shape mapping?

---

<div class="post-metadata">

**Author:** ![RahulD](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@RahulD](https://discuss.elastic.co/u/RahulD)\
**Post date:** [March 8, 2019, 4:46pm UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/3 "2019-03-08T16:46:31Z")

</div>

Can you share your index mapping? and a sample document?

---

<div class="post-metadata">

**Author:** ![Amjad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Amjad\_Khan](https://discuss.elastic.co/u/Amjad_Khan)\
**Post date:** [March 11, 2019, 6:03am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/4 "2019-03-11T06:03:07Z")

</div>

PUT way  
{

"settings" : {  
"number\_of\_shards" : 1,  
"refresh\_interval": "10s",  
"number\_of\_replicas": 0  
},  
"mappings": {  
"doc": {  
"properties": {  
"geometry": {  
"type": "geo\_shape"  
},  
"properties": {  
"enabled": false,  
"properties": {  
"area\_name": {  
"type": "text"  
},  
"area\_nm\_tr": {  
"type": "text"  
},  
"country\_name": {  
"type": "text"  
},  
"country\_nm\_tr": {  
"type": "text"  
},  
"emirate\_name": {  
"type": "text"  
},  
"emirate\_nm\_tr": {  
"type": "text"  
},  
"st\_nm\_tr": {  
"type": "text"  
},  
"fr\_spd\_lim": {  
"type": "float"  
},  
"interinter": {  
"type": "text"  
},  
"link\_id": {  
"type": "float"  
},  
"manoeuvre": {  
"type": "text"  
},  
"mod\_val": {  
"type": "text"  
},  
"ramp": {  
"type": "text"  
},  
"roundabout": {  
"type": "text"  
},  
"speed\_cat": {  
"type": "text"  
},  
"st\_name": {  
"type": "text"  
},  
"to\_spd\_lim": {  
"type": "float"  
}  
}  
},  
"type": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
}  
}

}

---

<div class="post-metadata">

**Author:** ![Amjad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Amjad\_Khan](https://discuss.elastic.co/u/Amjad_Khan)\
**Post date:** [March 11, 2019, 6:05am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/5 "2019-03-11T06:05:04Z")

</div>

THANK YOU , this is my version  
{  
"name" : "7x3HJTA",  
"cluster\_name" : "elasticsearch",  
"cluster\_uuid" : "3dDbeVmUTF23lReUj9szdA",  
"version" : {  
"number" : "6.6.0",  
"build\_flavor" : "default",  
"build\_type" : "rpm",  
"build\_hash" : "a9861f4",  
"build\_date" : "2019-01-24T11:27:09.439740Z",  
"build\_snapshot" : false,  
"lucene\_version" : "7.6.0",  
"minimum\_wire\_compatibility\_version" : "5.6.0",  
"minimum\_index\_compatibility\_version" : "5.0.0"  
},  
"tagline" : "You Know, for Search"  
}

I dont have this isssue with 6.1 or 6.3 versions.

---

<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:** [March 12, 2019, 4:25pm UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/6 "2019-03-12T16:25:49Z")

</div>

In 6.6 a new indexing strategy was introduced based on Lucene's BKD tree and a decomposition of polygons into triangles:

> <https://github.com/elastic/elasticsearch/issues/32039>

This strategy has been made the default and unfortunely it does not support filtering by distance yet. Therefore If you need such functionality you can just off the strategy to your mapping:

```auto
{
    "mappings": {
        "doc": {
            "properties": {
                "location": {
                    "type": "geo_shape",
                    "strategy" : "recursive"
                }
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![Amjad\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Amjad\_Khan](https://discuss.elastic.co/u/Amjad_Khan)\
**Post date:** [March 14, 2019, 8:51am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/7 "2019-03-14T08:51:38Z")

</div>

Thank you . Its worked .

Special :-  
I have the same issue of finding polygonal search with more vertices polygon . there I introduced polygon tiled into many squares and imported those , elastic-search , it give high precision search now.i

---

<div class="post-metadata">

**Author:** ![frankshad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frankshad/32/11031_2.png) [@frankshad](https://discuss.elastic.co/u/frankshad)\
**Post date:** [March 21, 2019, 8:48pm UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/8 "2019-03-21T20:48:46Z")

</div>

How do you deal with this the other way round, when the mapped item is a point (strictly, a geo\_shape which is a point) and the query is a geo\_shape containing a circle (using relation: within), which used to work before 6.6?

---

<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:** [March 22, 2019, 6:34am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/9 "2019-03-22T06:34:54Z")

</div>

I am not sure I understand your question @frankshad. If you are indexing only points I would considered mapping it to a `geo_point`. Otherwise if you want to use `geo_shape`, the workaround above should work as well.

---

<div class="post-metadata">

**Author:** ![frankshad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frankshad/32/11031_2.png) [@frankshad](https://discuss.elastic.co/u/frankshad)\
**Post date:** [March 22, 2019, 9:19am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/10 "2019-03-22T09:19:14Z")

</div>

I am searching for locations within a radius of the stored point, so the circle is in the query, not the stored data. (I already reindexed everything for 6.6, not realising circle was no longer supported).

Are you saying if I use geo\_point not geo\_shape in the mapping, circle will be recognized in the query? Or ditto if I add strategy recursive to the mapping, even though the the circle is in the query? I was expecting I wold have to add strategy to the query in this case (though part of the reason for re-indexing everything was to take advantage of the new triangles method).

e.g mapping:

```
{
    "address": {
        "type": "nested",
	    "dynamic": "strict",
        "properties": {
            "location": {
                "type": "geo_shape" // only ever contains a point
            },
            ...
       }
      ...
}

```

and eg query:

```
{"query":
   {"nested":{"path":"address",
     "query":{"geo_shape":{"address.location":
        {"relation":"within","shape":
          {"type":"circle",
           "coordinates": [-2.519474029541,51.47063764119], "radius":"500m"}
        }}}}}}
```

---

<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:** [March 22, 2019, 9:23am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/11 "2019-03-22T09:23:50Z")

</div>

If you are only indexing points I would recommend to use a geo\_point field:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html)

To be able to filter by distance you have a specialise query for that:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html)

---

<div class="post-metadata">

**Author:** ![frankshad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frankshad/32/11031_2.png) [@frankshad](https://discuss.elastic.co/u/frankshad)\
**Post date:** [March 22, 2019, 11:11am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/12 "2019-03-22T11:11:06Z")

</div>

Thanks, but that only works for the simple case I illustrated - there is a more complicated one which I also use, for hits within a given distance of a path. In that case it isn't just a circle, but a series of rectangles (determined by trigonometry from the line segments) and circles (at the ends and corners). (My third case which is inside a polygon, still works of course)

I guess I could do a bool search for the circles and the rectangles separately, though that's a fairly significant change to the code.

---

<div class="post-metadata">

**Author:** ![frankshad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frankshad/32/11031_2.png) [@frankshad](https://discuss.elastic.co/u/frankshad)\
**Post date:** [March 22, 2019, 11:15am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/13 "2019-03-22T11:15:37Z")

</div>

I think that's what I had better do, rather than going backwards to the older strategy which will get removed sometime anyway. Even though it means re-indexing again.

---

<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:** [March 22, 2019, 11:26am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/14 "2019-03-22T11:26:38Z")

</div>

Thanks for sharing your use case. One benefit you should see when indexing them as `geo_points` is that indexing should be much faster, the index size smaller and hopefully queries will be faster although this will depend on how many boolean queries you need to perform (still I think it will be faster).

One thing I can recommend is to open a feature request in the Elasticsearch repository to support such queries for geo\_points.

---

<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:** [April 19, 2019, 11:26am UTC](https://discuss.elastic.co/t/circle-geometry-is-not-supported/171093/15 "2019-04-19T11:26:45Z")

</div>

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