From baea06466262755132e375c2242f4c3d166b0aa7 Mon Sep 17 00:00:00 2001 From: Felix Borst Date: Thu, 23 Jun 2022 10:56:10 +0200 Subject: [PATCH 1/7] added indexingPolicy --- .../sqlDatabases/containers/deploy.bicep | 4 ++ .../sqlDatabases/containers/readme.md | 43 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/deploy.bicep b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/deploy.bicep index ca00dbe99e..26a5866d86 100644 --- a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/deploy.bicep +++ b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/deploy.bicep @@ -16,6 +16,9 @@ param tags object = {} @description('Optional. List of paths using which data within the container can be partitioned.') param paths array = [] +@description('Optional. Indexing policy of the container.') +param indexingPolicy object = {} + @description('Optional. Indicates the kind of algorithm used for partitioning.') @allowed([ 'Hash' @@ -54,6 +57,7 @@ resource container 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/container properties: { resource: { id: name + indexingPolicy: !empty(indexingPolicy) ? indexingPolicy : null partitionKey: { paths: paths kind: kind diff --git a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md index cbdf044023..3100420f3e 100644 --- a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md +++ b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md @@ -29,6 +29,7 @@ | Parameter Name | Type | Default Value | Allowed Values | Description | | :-- | :-- | :-- | :-- | :-- | | `enableDefaultTelemetry` | bool | `True` | | Enable telemetry via the Customer Usage Attribution ID (GUID). | +| `indexingPolicy` | object | `{object}` | | Indexing policy of the container. | | `kind` | string | `'Hash'` | `[Hash, MultiHash, Range]` | Indicates the kind of algorithm used for partitioning. | | `paths` | array | `[]` | | List of paths using which data within the container can be partitioned. | | `tags` | object | `{object}` | | Tags of the SQL Database resource. | @@ -76,6 +77,48 @@ tags: {

+### Parameter Usage: `indexingPolicy` + +Tag names and tag values can be provided as needed. A tag can be left without a value. + +

+ +Parameter JSON format + +```json + "indexingPolicy": { + "indexingMode": "consistent", + "includedPaths": [ + { + "path": "/*" + } + ], + "excludedPaths": [ + ] +}, +``` + +
+ +
+ +Bicep format + +```bicep + indexingPolicy: { + indexingMode: 'consistent' + includedPaths: [ + { + path: '/*' + } + ] + excludedPaths: [] +} +``` + +
+

+ ## Outputs | Output Name | Type | Description | From cf35e646661854c15450a3444441a1ac99ea85f2 Mon Sep 17 00:00:00 2001 From: Felix Borst Date: Thu, 23 Jun 2022 10:59:44 +0200 Subject: [PATCH 2/7] added to params --- .../.parameters/sqldb.parameters.json | 11 ++++++++++- .../sqlDatabases/containers/readme.md | 7 +++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arm/Microsoft.DocumentDB/databaseAccounts/.parameters/sqldb.parameters.json b/arm/Microsoft.DocumentDB/databaseAccounts/.parameters/sqldb.parameters.json index 11f83861d1..39bbfd12cd 100644 --- a/arm/Microsoft.DocumentDB/databaseAccounts/.parameters/sqldb.parameters.json +++ b/arm/Microsoft.DocumentDB/databaseAccounts/.parameters/sqldb.parameters.json @@ -42,7 +42,16 @@ "paths": [ "/myPartitionKey" ], - "kind": "Hash" + "kind": "Hash", + "indexingPolicy": { + "indexingMode": "consistent", + "includedPaths": [ + { + "path": "/*" + } + ], + "excludedPaths": [] + } } ] }, diff --git a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md index 3100420f3e..b79f4cc799 100644 --- a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md +++ b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md @@ -35,7 +35,6 @@ | `tags` | object | `{object}` | | Tags of the SQL Database resource. | | `throughput` | int | `400` | | Request Units per second. | - ### Parameter Usage: `tags` Tag names and tag values can be provided as needed. A tag can be left without a value. @@ -86,7 +85,7 @@ Tag names and tag values can be provided as needed. A tag can be left without a

Parameter JSON format ```json - "indexingPolicy": { +"indexingPolicy": { "indexingMode": "consistent", "includedPaths": [ { @@ -95,7 +94,7 @@ Tag names and tag values can be provided as needed. A tag can be left without a ], "excludedPaths": [ ] -}, +} ``` @@ -105,7 +104,7 @@ Tag names and tag values can be provided as needed. A tag can be left without a Bicep format ```bicep - indexingPolicy: { +indexingPolicy: { indexingMode: 'consistent' includedPaths: [ { From be77906285959c2ab88c479fc3552bc75a09fe30 Mon Sep 17 00:00:00 2001 From: Felix Borst Date: Thu, 23 Jun 2022 11:03:29 +0200 Subject: [PATCH 3/7] fixes --- .../databaseAccounts/sqlDatabases/containers/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md index b79f4cc799..0223c6f481 100644 --- a/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md +++ b/arm/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md @@ -35,6 +35,7 @@ | `tags` | object | `{object}` | | Tags of the SQL Database resource. | | `throughput` | int | `400` | | Request Units per second. | + ### Parameter Usage: `tags` Tag names and tag values can be provided as needed. A tag can be left without a value. From 29df088b0a6fadfe82348efb3c21309e415a15a7 Mon Sep 17 00:00:00 2001 From: Felix Borst Date: Thu, 23 Jun 2022 14:04:09 +0200 Subject: [PATCH 4/7] updated readme --- .../databaseAccounts/readme.md | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/arm/Microsoft.DocumentDB/databaseAccounts/readme.md b/arm/Microsoft.DocumentDB/databaseAccounts/readme.md index 5330eb80d5..010158ea3e 100644 --- a/arm/Microsoft.DocumentDB/databaseAccounts/readme.md +++ b/arm/Microsoft.DocumentDB/databaseAccounts/readme.md @@ -1091,7 +1091,16 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = "paths": [ "/myPartitionKey" ], - "kind": "Hash" + "kind": "Hash", + "indexingPolicy": { + "indexingMode": "consistent", + "includedPaths": [ + { + "path": "/*" + } + ], + "excludedPaths": [] + } } ] }, @@ -1168,6 +1177,15 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = '/myPartitionKey' ] kind: 'Hash' + indexingPolicy: { + indexingMode: 'consistent' + includedPaths: [ + { + path: '/*' + } + ] + excludedPaths: [] + } } ] } From 305cc77c9a5868257f30a5e77648e0782e9fa4b8 Mon Sep 17 00:00:00 2001 From: Felix Borst Date: Thu, 1 Dec 2022 10:38:52 +0100 Subject: [PATCH 5/7] updated readme --- .../databaseAccounts/sqlDatabases/containers/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md b/modules/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md index c14712fde2..f23dc4c25d 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md +++ b/modules/Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readme.md @@ -33,6 +33,7 @@ | Parameter Name | Type | Default Value | Allowed Values | Description | | :-- | :-- | :-- | :-- | :-- | | `enableDefaultTelemetry` | bool | `True` | | Enable telemetry via a Globally Unique Identifier (GUID). | +| `indexingPolicy` | object | `{object}` | | Indexing policy of the container. | | `kind` | string | `'Hash'` | `[Hash, MultiHash, Range]` | Indicates the kind of algorithm used for partitioning. | | `paths` | array | `[]` | | List of paths using which data within the container can be partitioned. | | `tags` | object | `{object}` | | Tags of the SQL Database resource. | From e25689971d872f97d990cc23c646e7b8e069f6d8 Mon Sep 17 00:00:00 2001 From: Felix Borst Date: Thu, 1 Dec 2022 10:54:43 +0100 Subject: [PATCH 6/7] *added indexing policy to gremlin *added tests for sql and gremlin --- .../.test/gremlindb/deploy.test.bicep | 16 ++++++++++++---- .../.test/sqldb/deploy.test.bicep | 3 +++ .../gremlinDatabases/graphs/deploy.bicep | 8 +++----- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep index d8f7c71005..031c6907c5 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep @@ -83,14 +83,18 @@ module testDeployment '../../deploy.bicep' = { { graphs: [ { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'car_collection' partitionKeyPaths: [ '/car_id' ] } { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'truck_collection' partitionKeyPaths: [ '/truck_id' @@ -102,14 +106,18 @@ module testDeployment '../../deploy.bicep' = { { collections: [ { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'bike_collection' partitionKeyPaths: [ '/bike_id' ] } { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'bicycle_collection' partitionKeyPaths: [ '/bicycle_id' diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep index 746545e569..7efb88ba79 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep @@ -92,6 +92,9 @@ module testDeployment '../../deploy.bicep' = { { kind: 'Hash' name: 'container-001' + indexingPolicy: { + automatic: true + } paths: [ '/myPartitionKey' ] diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/deploy.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/deploy.bicep index e5f31774e5..b8fdee416e 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/deploy.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/deploy.bicep @@ -13,8 +13,8 @@ param databaseAccountName string @description('Conditional. The name of the parent Gremlin Database. Required if the template is used in a standalone deployment.') param gremlinDatabaseName string -@description('Optional. Indicates if the indexing policy is automatic.') -param automaticIndexing bool = true +@description('Optional. Indexing policy of the graph.') +param indexingPolicy object = {} @description('Optional. List of paths using which data within the container can be partitioned.') param partitionKeyPaths array = [] @@ -46,9 +46,7 @@ resource gremlinGraph 'Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/gr properties: { resource: { id: name - indexingPolicy: { - automatic: automaticIndexing - } + indexingPolicy: !empty(indexingPolicy) ? indexingPolicy : null partitionKey: { paths: !empty(partitionKeyPaths) ? partitionKeyPaths : null } From ffe9bed4159e5950e2da5f8de10d1a86812faa88 Mon Sep 17 00:00:00 2001 From: Felix Borst Date: Thu, 1 Dec 2022 11:38:06 +0100 Subject: [PATCH 7/7] fixed readme --- .../gremlinDatabases/deploy.bicep | 2 +- .../gremlinDatabases/graphs/readme.md | 2 +- .../databaseAccounts/readme.md | 38 +++++++++++++++---- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/deploy.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/deploy.bicep index 2fbea19aa1..075ca6afb1 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/deploy.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/deploy.bicep @@ -77,7 +77,7 @@ module gremlinDatabase_gremlinGraphs 'graphs/deploy.bicep' = [for graph in graph gremlinDatabaseName: name databaseAccountName: databaseAccountName enableDefaultTelemetry: enableReferencedModulesTelemetry - automaticIndexing: contains(graph, 'automaticIndexing') ? graph.automaticIndexing : true + indexingPolicy: contains(graph, 'indexingPolicy') ? graph.indexingPolicy : true partitionKeyPaths: !empty(graph.partitionKeyPaths) ? graph.partitionKeyPaths : [] } }] diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/readme.md b/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/readme.md index 64cfdd35f4..fcfedef2ea 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/readme.md +++ b/modules/Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs/readme.md @@ -34,8 +34,8 @@ This module deploys DocumentDB DatabaseAccounts GremlinDatabases Graphs. | Parameter Name | Type | Default Value | Description | | :-- | :-- | :-- | :-- | -| `automaticIndexing` | bool | `True` | Indicates if the indexing policy is automatic. | | `enableDefaultTelemetry` | bool | `True` | Enable telemetry via a Globally Unique Identifier (GUID). | +| `indexingPolicy` | object | `{object}` | Indexing policy of the graph. | | `partitionKeyPaths` | array | `[]` | List of paths using which data within the container can be partitioned. | | `tags` | object | `{object}` | Tags of the Gremlin graph resource. | diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md index f973849229..18949e53fa 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md +++ b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md @@ -582,14 +582,18 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { graphs: [ { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'car_collection' partitionKeyPaths: [ '/car_id' ] } { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'truck_collection' partitionKeyPaths: [ '/truck_id' @@ -601,14 +605,18 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { collections: [ { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'bike_collection' partitionKeyPaths: [ '/bike_id' ] } { - automaticIndexing: true + indexingPolicy: { + automatic: true + } name: 'bicycle_collection' partitionKeyPaths: [ '/bicycle_id' @@ -692,14 +700,18 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { "graphs": [ { - "automaticIndexing": true, + "indexingPolicy": { + "automatic": true + }, "name": "car_collection", "partitionKeyPaths": [ "/car_id" ] }, { - "automaticIndexing": true, + "indexingPolicy": { + "automatic": true + }, "name": "truck_collection", "partitionKeyPaths": [ "/truck_id" @@ -711,14 +723,18 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { "collections": [ { - "automaticIndexing": true, + "indexingPolicy": { + "automatic": true + }, "name": "bike_collection", "partitionKeyPaths": [ "/bike_id" ] }, { - "automaticIndexing": true, + "indexingPolicy": { + "automatic": true + }, "name": "bicycle_collection", "partitionKeyPaths": [ "/bicycle_id" @@ -1402,6 +1418,9 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { containers: [ { + indexingPolicy: { + automatic: true + } kind: 'Hash' name: 'container-001' paths: [ @@ -1491,6 +1510,9 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { "containers": [ { + "indexingPolicy": { + "automatic": true + }, "kind": "Hash", "name": "container-001", "paths": [