Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
While many features are automatically enabled and built-in to Cosmos DB in Microsoft Fabric, there are still a few places where you can customize the behavior of your container through configuration. In this guide, you walk through the steps to configure the most common customizable settings for a container in your Cosmos DB in Fabric database.
Prerequisites
An existing Fabric capacity
- If you don't have Fabric capacity, start a Fabric trial.
An existing Cosmos DB database in Fabric
- If you don't have one already, create a new Cosmos DB database in Fabric.
An existing container with data
- If you don't have one already, we suggest that you load the sample data container.
Update settings
To modify a Cosmos DB container, open the Settings section for a container in the Fabric portal. Settings which can be customized time-to-live (TTL), geospatial configuration, and indexing policy.
Note
The vector and full-text container policy, partition keys are immutable and cannot be changed after container creation. Container throughput cannot be changed in the Fabric portal but can be modified using the Cosmos DB SDK. See Change Throughput for details.
Open the Fabric portal (https://app.fabric.microsoft.com).
Navigate to your existing Cosmos DB database.
Select and expand your existing container. Then, select Settings.
In the Settings section, select the redundant Settings tab.
Time-to-live and geospatial configuration
To configure the Time to Live and Geospatial Configuration values, change the values below.
Select Save to persist your changes.
Note
Time-to-live (TTL) on a container will also apply to any data mirrored to OneLake. For more information on time-to-live (TTL) configuration, see time-to-live. For more information on geospatial configuration, see geospatial data.
Indexing policy
The Indexing Policy section will customize the indexing for your container. Indexing customizes how Cosmos DB converts items into a tree representation internally. Customizing the indexing policy can tune the performance of the queries for your container or improve write performance of your data.
Still in the Settings section, select the Indexing Policy tab.
Update the editor with a new JSON indexing policy:
{ "indexingMode": "consistent", "automatic": true, "includedPaths": [ { "path": "/*" } ], "excludedPaths": [ { "path": "/\"_etag\"/?" } ] }Note
By default, Cosmos DB in Fabric automatically indexes every property for all items in your container. The policy illustrated in this example is the default policy for a new container.
Select Save to persist your changes.
Tip
For more information on indexing, see indexing policies.
Change Throughput
The throughput of your containers can be done using the Cosmos DB SDK. This can be easily done using a Notebook in Fabric. Below is a simplified sample. For a complete sample notebook see, Management Operations for Cosmos DB in Fabric. This provides a complete sample notebook you can import into your workspace to use.
# Get the current throughput on the created container and increase it by 1000 RU/s
throughput_properties = await CONTAINER.get_throughput()
autoscale_throughput = throughput_properties.auto_scale_max_throughput
print(print(f"Autoscale throughput: {autoscale_throughput}"))
new_throughput = autoscale_throughput + 1000
await CONTAINER.replace_throughput(ThroughputProperties(auto_scale_max_throughput=new_throughput))
# Verify the updated throughput
updated_throughput_properties = await CONTAINER.get_throughput()
print(f"Verified updated autoscale throughput: {updated_throughput_properties.auto_scale_max_throughput}")