Azure 为什么CosmosDB在通过ARM模板创建文档集合时忽略索引?
给定ARM模板:Azure 为什么CosmosDB在通过ARM模板创建文档集合时忽略索引?,azure,azure-cosmosdb,azure-resource-manager,Azure,Azure Cosmosdb,Azure Resource Manager,给定ARM模板: { "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "resources": [ { "name": "1test2/sql/2test3/3test4", "type": "Microsoft.DocumentDB/databaseAcc
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "1test2/sql/2test3/3test4",
"type": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers",
"apiVersion": "2015-04-08",
"properties": {
"resource": {
"id": "3test4",
"indexingPolicy": {
"indexingMode": "Consistent",
"includedPaths": [
{
"path": "/definition/property/?",
"indexes": [
{
"kind": "Range",
"dataType": "String"
}
]
}
],
"excludedPaths": [
{
"path": "/*"
}
]
},
"partitionKey": {
"paths": [
"/definition/id"
],
"kind": "Hash"
},
},
"options": {}
}
}
]
}
使用PowerShell命令部署到现有CosmosDB数据库时
新的AzureRmResourceGroupDeployment,生成的索引设置为:
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/definition/property/?",
"indexes": []
}
],
"excludedPaths": [
{
"path": "/*"
},
{
"path": "/\"_etag\"/?"
}
]
}
因此,虽然CosmosDB接受“includedPath”,但它忽略了“索引”。我是做错了什么,还是应该这样做?最近对Cosmos DB索引引擎进行了更改,该引擎默认为字符串和数字的范围索引,精度为-1 ARM模板和文档尚未更新以将其反映为默认值
如果对索引策略进行了非默认更改(例如,添加空间索引),则这些更改将包含在部署的容器中。我可以看到的唯一区别是
“精度”:-1indexes@4c74356b41谢谢-但我也很精确地尝试过(我的原始文档中有)但我删除了它,以使复制尽可能简单。尝试使用相同的apiversion:“apiversion”:“2016-03-31”,
事实上,官方示例似乎没有设置这些属性,Lol尝试了建议的apiversion,但仍然没有骰子:-(我想知道是否有类似的情况发生。感谢确认。