DocumentDB: Removing default indexing

前端 未结 2 1460
心在旅途
心在旅途 2020-12-17 04:43

I am trying to remove the default indexes which are created for a new collection:

{
  \"indexingMode\": \"lazy\",
  \"automatic\": true,
  \"includedPaths\":         


        
相关标签:
2条回答
  • 2020-12-17 05:18

    An easy way to exclude everything would be to switch indexingMode: None

    0 讨论(0)
  • 2020-12-17 05:37

    Sounds like you've pretty much figured it out. To clarify, id and _ts are treated as special properties in regards to indexing.

    • id is implicitly treated as the document's primary key - in which, id will always be indexed with uniqueness enforced.

    • _ts is an epoch timestamp of when a document was last written (create or replace), and will also always be indexed. This property will be explicitly noted within the index policy.

    The following indexing policy illustrated how to index only the document.prop.subprop property (along with id and _ts):

    {
      "indexingMode": "consistent",
      "automatic": true,
      "includedPaths": [
        {
          "path": "/prop/subprop/?",
          "indexes": [
            {
              "kind": "Range",
              "dataType": "Number",
              "precision": -1
            },
            {
              "kind": "Range",
              "dataType": "String",
              "precision": -1
            }
          ]
        },
        {
          "path": "/\"_ts\"/?",
          "indexes": [
            {
              "kind": "Range",
              "dataType": "Number",
              "precision": -1
            },
            {
              "kind": "Hash",
              "dataType": "String",
              "precision": 3
            }
          ]
        }
      ],
      "excludedPaths": [
        {
          "path": "/*"
        }
      ]
    }
    
    0 讨论(0)
提交回复
热议问题