Cosmos DB - Indexing Policy Settings

故事扮演 提交于 2020-01-06 08:13:02

问题


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\"/?"
        }
    ]
}

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?

Any help would be great!


回答1:


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



来源:https://stackoverflow.com/questions/55245111/cosmos-db-indexing-policy-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!