Cosmos DB-索引策略设置 [英] Cosmos DB - Indexing Policy Settings

查看:140
本文介绍了Cosmos DB-索引策略设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using the azure cli in order to set my indexing policy. I am using the following JSON:

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

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

The script reports no errors have occurred, however when I log into the portal and look at the indexing policy, it shows the following:

{
    "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和索引,因此我不确定这是故意的还是做错了什么.还是两者相等?

The portal settings include an extra excludedPath and index, so I am not sure if this is intentional or I am doing something wrong. Or are the two equivalent?

任何帮助都会很棒!

推荐答案

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

Since indexing v2 came out the default indexing will add range for both strings and numbers and it will also automatically exclude the ETag.

这篇关于Cosmos DB-索引策略设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆