What indexing mode / policy should I use when using cosmos db as a simple key/value store?
From https://docs.microsoft.com/en-us/azure/cosmos-db/index-policy :
None: Indexing is disabled on the container. This is commonly used when a container is used as a pure key-value store without the need for secondary indexes.
Is this because the property used as partition key is indexed even when indexMode is set to “none”? I would expect to need to turn indexing on but specify just the partition key’s path as the only included path.
If it matters, I’m planning to use the SQL API.
EDIT:
here's the information I was missing to understand this:
- The item must have an
idproperty, otherwise cosmos db will assign one. https://docs.microsoft.com/en-us/azure/cosmos-db/account-databases-containers-items#properties-of-an-item - Since I'm using Azure Data Factory to load the items, I can tell ADF to duplicate the column that has the value I want to use as my id into a new column called
id: https://docs.microsoft.com/en-us/azure/data-factory/copy-activity-overview#add-additional-columns-during-copy - I need to use
ReadItemAsync, or better yet,ReadItemStreamAsyncsince it doesn't deserialize the response, to get the item without using a query. https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.container.readitemasync?view=azure-dotnet https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.container.readitemstreamasync?view=azure-dotnet