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

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

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.

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