'How to enable large partition key option on existing container in Azure cosmos db

I see that cosmosDb now supports large partition keys (up to 2kbs) but by default it uses 100 bytes to store that data.

In microsoft docs i've found how this option can be enabled for existing containers - link

Is there a way to enable this somehow for already existing containers ? And is there any risk in doing that ?



Solution 1:[1]

You will need to migrate all documents to a new collection with the option enabled.

Because this option changes the result of the hash operation against the partition key documents could end up hashed into different partitions with new and old schemes so it can't be done on an existing collection (in the same way as changing the partition key itself can't be done to an existing collection).

Regarding risks I'm not aware of any other than listed in the documentation that you yourself posted.

unless you need support for an older Cosmos SDK or application that does not support this feature, it is always recommended to configure your container with support for large partition keys. .... Currently, you cannot use containers with large partition key within in Power BI and Azure Logic Apps. You can use containers without a large partition key from these applications.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin Smith