Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 是否可以使用ARM模板创建CosmosDB的复合索引_Azure_Indexing_Azure Cosmosdb_Azure Resource Manager - Fatal编程技术网

Azure 是否可以使用ARM模板创建CosmosDB的复合索引

Azure 是否可以使用ARM模板创建CosmosDB的复合索引,azure,indexing,azure-cosmosdb,azure-resource-manager,Azure,Indexing,Azure Cosmosdb,Azure Resource Manager,我找到了使用ARM模板创建或更改CosmosDB的说明,但没有一个包含如何向模板添加CompositeIndex的说明。我还听说模板中不支持它,必须使用PowerShell或Azure CLI脚本完成,但无法在网上找到支持它的内容。有人能解释一下吗?我没有测试过,但根据Microsoft.DocumentDB资源提供程序文档/模板参考,有一个Microsoft.DocumentDB/databaseAccounts/API/databases/containers资源可以满足您的需要 每个容器在

我找到了使用ARM模板创建或更改CosmosDB的说明,但没有一个包含如何向模板添加CompositeIndex的说明。我还听说模板中不支持它,必须使用PowerShell或Azure CLI脚本完成,但无法在网上找到支持它的内容。有人能解释一下吗?

我没有测试过,但根据Microsoft.DocumentDB资源提供程序文档/模板参考,有一个Microsoft.DocumentDB/databaseAccounts/API/databases/containers资源可以满足您的需要

每个容器在模板架构中都有一个索引策略,该策略包含一个IncludedPath对象数组,其本身包含一个索引对象数组,如下所示:

        "includedPaths": [
          {
            "path": "string",
            "indexes": [
              {
                "dataType": "string",
                "precision": "integer",
                "kind": "string"
              }
            ]
          }
        ]
它被视为一个独立于数据库/帐户的资源。您可能希望使用适当的dependsOn值将此资源添加到模板中,以确保它在数据库之后部署

您可以添加多个路径,从而创建复合索引

完整架构如下所示:

如果这样做不起作用,您可能也希望看到这一点,因为架构文档可能已经过时,并且可能支持复合索引:


看起来没有手臂支撑。这就是为什么我认为ARM在很多情况下都不是最好的方法,我宁愿使用Powershell或Azure cliyeah,但我在文档中找不到它:显然不支持compositeindex: