-
Notifications
You must be signed in to change notification settings - Fork 46
New CosmosDbCollectionIndexingPolicy
Creates an indexing policy object that can be passed to the New-CosmosDbCollection function.
New-CosmosDbCollectionIndexingPolicy [[-Automatic] <Boolean>] [[-IndexingMode] <String>]
[[-IncludedPath] <IncludedPath[]>] [[-ExcludedPath] <ExcludedPath[]>]
[[-CompositeIndex] <Element[][]>] [<CommonParameters>]
This function will return an indexing policy object that can be passed to the New-CosmosDbCollection function to configure custom indexing policies on a collection.
PS C:\> $indexStringRange = New-CosmosDbCollectionIncludedPathIndex -Kind Range -DataType String -Precision -1
PS C:\> $indexNumberRange = New-CosmosDbCollectionIncludedPathIndex -Kind Range -DataType Number -Precision -1
PS C:\> $indexIncludedPath = New-CosmosDbCollectionIncludedPath -Path '/*' -Index $indexStringRange, $indexNumberRange
PS C:\> $indexExcludedPath = New-CosmosDbCollectionExcludedPath -Path '/test/*'
PS C:\> $indexingPolicy = New-CosmosDbCollectionIndexingPolicy -Automatic $true -IndexingMode Consistent -IncludedPath $indexIncludedPath -ExcludedPath $indexExcludedPath
PS C:\> New-CosmosDbCollection -Context $cosmosDbContext -Id 'MyNewCollection' -PartitionKey 'account' -IndexingPolicy $indexingPolicy
Create a new collection with a custom indexing policy.
PS C:\> $indexIncludedPath = New-CosmosDbCollectionIncludedPath -Path '/*'
PS C:\> $compositeIndexElements = @(
@(
(New-CosmosDbCollectionCompositeIndexElement -Path '/name' -Order 'Ascending'),
(New-CosmosDbCollectionCompositeIndexElement -Path '/age' -Order 'Ascending')
),
@(
(New-CosmosDbCollectionCompositeIndexElement -Path '/name' -Order 'Ascending'),
(New-CosmosDbCollectionCompositeIndexElement -Path '/age' -Order 'Descending')
)
)
PS C:\> $indexingPolicy = New-CosmosDbCollectionIndexingPolicy -Automatic $true -IndexingMode Consistent -IncludedPath $indexIncludedPath -CompositeIndex $compositeIndexElements
PS C:\> New-CosmosDbCollection -Context $cosmosDbContext -Id 'MyNewCollection' -PartitionKey 'account' -IndexingPolicy $indexingPolicy
Create a new collection with a custom indexing policy containing composite indexes.
Indicates whether automatic indexing is on or off. The default value is True, thus all documents are indexed. Setting the value to False would allow manual configuration of indexing paths.
Type: Boolean
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: True
Accept pipeline input: False
Accept wildcard characters: False
The array containing document paths to be excluded from indexing.
Type: ExcludedPath[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
An array of arrays containing composite index elements created by New-CosmosDbCollectionCompositeIndexElement.
Type: Element[][]
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: @(@())
Accept pipeline input: False
Accept wildcard characters: False
The array containing document paths to be indexed. By default, two paths are included: the / path which specifies that all document paths be indexed, and the _ts path, which indexes for a timestamp range comparison.
Type: IncludedPath[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
By default, the indexing mode is Consistent. This means that indexing occurs synchronously during insertion, replacment or deletion of documents. To have indexing occur asynchronously, set the indexing mode to lazy. A collection that has an index mode of None has no index associated with it. This is commonly used if Azure Cosmos DB is used as a key-value storage, and documents are accessed only by their ID property. When using None as the indexing mode, automatic must be set to False.
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: Consistent, Lazy, None
Required: False
Position: 1
Default value: Consistent
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
https://docs.microsoft.com/en-nz/azure/cosmos-db/index-policy#composite-indexes
- ConvertTo-CosmosDbTokenDateString
- Get-CosmosDbAccount
- Get-CosmosDbAccountConnectionString
- Get-CosmosDbAccountMasterKey
- Get-CosmosDbAttachment
- Get-CosmosDbAttachmentResourcePath
- Get-CosmosDbAuthorizationHeaderFromContext
- Get-CosmosDbCollection
- Get-CosmosDbCollectionResourcePath
- Get-CosmosDbDatabase
- Get-CosmosDbDatabaseResourcePath
- Get-CosmosDbDocument
- Get-CosmosDbDocumentResourcePath
- Get-CosmosDbEntraIdToken
- Get-CosmosDbOffer
- Get-CosmosDbOfferResourcePath
- Get-CosmosDbPermission
- Get-CosmosDbPermissionResourcePath
- Get-CosmosDbStoredProcedure
- Get-CosmosDbStoredProcedureResourcePath
- Get-CosmosDbTrigger
- Get-CosmosDbTriggerResourcePath
- Get-CosmosDbUri
- Get-CosmosDbUser
- Get-CosmosDbUserDefinedFunction
- Get-CosmosDbUserDefinedFunctionResourcePath
- Get-CosmosDbUserResourcePath
- Invoke-CosmosDbRequest
- Invoke-CosmosDbStoredProcedure
- New-CosmosDbAccount
- New-CosmosDbAccountMasterKey
- New-CosmosDbAttachment
- New-CosmosDbBackoffPolicy
- New-CosmosDbContext
- New-CosmosDbCollection
- New-CosmosDbCollectionExcludedPath
- New-CosmosDbCollectionIncludedPath
- New-CosmosDbCollectionIncludedPathIndex
- New-CosmosDbCollectionIndexingPolicy
- New-CosmosDbCollectionUniqueKey
- New-CosmosDbCollectionUniqueKeyPolicy
- New-CosmosDbDatabase
- New-CosmosDbDocument
- New-CosmosDbInvalidArgumentException
- New-CosmosDbInvalidOperationException
- New-CosmosDbPermission
- New-CosmosDbStoredProcedure
- New-CosmosDbTrigger
- New-CosmosDbUser
- New-CosmosDbUserDefinedFunction
- Remove-CosmosDbAccount
- Remove-CosmosDbAttachment
- Remove-CosmosDbCollection
- Remove-CosmosDbDatabase
- Remove-CosmosDbDocument
- Remove-CosmosDbPermission
- Remove-CosmosDbStoredProcedure
- Remove-CosmosDbTrigger
- Remove-CosmosDbUser
- Remove-CosmosDbUserDefinedFunction
- Set-CosmosDbAccount
- Set-CosmosDbAttachment
- Set-CosmosDbAttachmentType
- Set-CosmosDbCollectionType
- Set-CosmosDbDatabaseType
- Set-CosmosDbDocument
- Set-CosmosDbDocumentType
- Set-CosmosDbOffer
- Set-CosmosDbOfferType
- Set-CosmosDbPermissionType
- Set-CosmosDbStoredProcedure
- Set-CosmosDbStoredProcedureType
- Set-CosmosDbTrigger
- Set-CosmosDbTriggerType
- Set-CosmosDbUser
- Set-CosmosDbUserDefinedFunction
- Set-CosmosDbUserDefinedFunctionType
- Set-CosmosDbUserType