Search code examples
azure-cosmosdbgeospatialgeojson

Cosmosdb cross partition query issue


I have a collection which has geo-spatial data and its partitioned by a parameter calculated from the latitudes and longitudes. I run following query

SELECT * FROM aggregations w WHERE ST_DISTANCE(w.geometry, {'type': 'Point', 'coordinates': [ -122.31208346990059, 47.57628387483156]}) < 200.0

which returns data when the collection is non partitioned but when its partitioned by a field called

"cell" = "30696-65181-1"

I get no response.

In python I tried following options

options = dict()
options['enableCrossPartitionQuery'] = False
options['partitionKey'] = '30696-65181-1'

Also tried

 options = dict()
 options['enableCrossPartitionQuery'] = True

But I still dont get any output from the query.


Solution

  • It seems by default the indexing for spatial parameters was only Point based. I added the Polygon indexing too and then it worked.