Cosmos DB-索引策略设置

时间:2019-03-19 15:54:21

标签: azure-cosmosdb azure-cli azure-cosmosdb-sqlapi

我正在使用azure cli来设置索引策略。我正在使用以下JSON:

{
  "indexingMode": "consistent",
  "automatic": true,
  "includedPaths": [
    {
      "path": "/ttl/?",
      "indexes": [
        {
          "kind": "Range",
          "dataType": "Number",
          "precision": -1
        }
      ]
    }
  ],
  "excludedPaths": [
    {
      "path": "/*"
    }
  ]
}

该脚本报告未发生任何错误,但是,当我登录到门户网站并查看索引策略时,它显示以下内容:

{
    "indexingMode": "consistent",
    "automatic": true,
    "includedPaths": [
        {
            "path": "/ttl/?",
            "indexes": [
                {
                    "kind": "Range",
                    "dataType": "Number",
                    "precision": -1
                },
                {
                    "kind": "Range",
                    "dataType": "String",
                    "precision": -1
                }
            ]
        }
    ],
    "excludedPaths": [
        {
            "path": "/*"
        },
        {
            "path": "/\"_etag\"/?"
        }
    ]
}

门户设置包括一个额外的excludePath和索引,所以我不确定这是故意的还是做错了什么。还是两者相等?

任何帮助都会很棒!

1 个答案:

答案 0 :(得分:1)

自从索引v2发布以来,默认的索引将为字符串和数字添加范围,并且还将自动排除ETag。