# How find intersections with a circle, that have 2 different radius

**URL:** <https://discuss.elastic.co/t/how-find-intersections-with-a-circle-that-have-2-different-radius/190873>\
**Category:** Elasticsearch\
**Created:** [July 17, 2019, 5:19am UTC](https://discuss.elastic.co/t/how-find-intersections-with-a-circle-that-have-2-different-radius/190873 "2019-07-17T05:19:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aday\_igibaev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aday_igibaev/32/50326_2.png) [@Aday\_igibaev](https://discuss.elastic.co/u/Aday_igibaev)\
**Post date:** [July 17, 2019, 5:19am UTC](https://discuss.elastic.co/t/how-find-intersections-with-a-circle-that-have-2-different-radius/190873/1 "2019-07-17T05:19:59Z")

</div>

I have this document (the structure of document can be changed)

```
"id" : "1",
          "location" : {
            "type" : "geometrycollection",
            "geometries" : [
              {
                "type" : "circle",
                "coordinates" : [
                  47.3188019,
                  47.3188019
                ],
                "radius" : 500
              },
              {
                "type" : "circle",
                "coordinates" : [
                  47.3188019,
                  47.3188019
                ],
                "radius" : 2000
              }
            ]
          }
        }

```

when i tried to find intersections or within(radius 500), with this geo queres  
{  
"query":{  
"bool": {  
"must": {  
"match\_all": {}  
},  
"filter": {  
"geo\_shape": {  
"location": {  
"shape": {  
"type": "circle",  
"coordinates": [  
47.3188019,  
47.3188019  
],  
"radius": 500  
},  
"relation": "within"  
}  
}  
}  
}  
}  
}  
it don't find any document, but when a changed it to radius=2000, it working  
so the questions, is it possible to find document with radius=500

---

<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:** [July 17, 2019, 10:45am UTC](https://discuss.elastic.co/t/how-find-intersections-with-a-circle-that-have-2-different-radius/190873/2 "2019-07-17T10:45:26Z")

</div>

I think the system is working as expected. If you use a geometry collection, the query only returns the document if all the geometry collection is within the query provided.

If you want to treat every element of the geometry collection as a shape, I think your best option is to model the field as a nested field, and add every shape in the geometry collection as a separate nested field.

---

<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:** [August 14, 2019, 10:45am UTC](https://discuss.elastic.co/t/how-find-intersections-with-a-circle-that-have-2-different-radius/190873/3 "2019-08-14T10:45:33Z")

</div>

Closed on August 14, 2019, 10:45am UTC

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