New-AzCosmosDBSqlIndexingPolicy

Creates a new CosmosDB Sql IndexingPolicy object.

Syntax

New-AzCosmosDBSqlIndexingPolicy
   [-IncludedPath <PSIncludedPath[]>]
   [-SpatialSpec <PSSpatialSpec[]>]
   [-CompositePath <PSCompositePath[][]>]
   [-ExcludedPath <String[]>]
   [-Automatic <Boolean>]
   [-IndexingMode <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzCosmosDBSqlIndexingPolicy cmdlet creates a new object of type PSSqlIndexingPolicy.

Examples

Example 1

PS C:\> $ipath1 = New-AzCosmosDBSqlIncludedPathIndex -DataType String -Precision -1 -Kind Hash
PS C:\> $ipath2 = New-AzCosmosDBSqlIncludedPathIndex -DataType String -Precision -1 -Kind Hash
PS C:\> $IncludedPath = New-AzCosmosDBSqlIncludedPath -Path "/*" -Index $ipath1, $ipath2
PS C:\>  $SpatialSpec = New-AzCosmosDBSqlSpatialSpec -Path  "/mySpatialPath/*" -Type  "Point", "LineString", "Polygon", "MultiPolygon"
PS C:\> $cp1 = New-AzCosmosDBSqlCompositePath -Path "/abc" -Order Ascending
PS C:\>  $cp2 = New-AzCosmosDBSqlCompositePath -Path "/aberc" -Order Descending
PS C:\> $compositePath = (($cp1, $cp2), ($cp2, $cp1))
PS C:\> New-AzCosmosDBSqlIndexingPolicy -IncludedPath $IncludedPath -SpatialSpec $SpatialSpec -CompositePath $compositePath -ExcludedPath "/myPathToNotIndex/*" -Automatic 1 -IndexingMode Consistent

Automatic        : True
IndexingMode     : Consistent
IncludedPaths    : {Microsoft.Azure.Commands.CosmosDB.Models.PSIncludedPath}
ExcludedPaths    : {Microsoft.Azure.Commands.CosmosDB.Models.PSExcludedPath}
CompositeIndexes : {Microsoft.Azure.Commands.CosmosDB.Models.PSCompositePath Microsoft.Azure.Commands.CosmosDB.Models.PSCompositePath,
                   Microsoft.Azure.Commands.CosmosDB.Models.PSCompositePath Microsoft.Azure.Commands.CosmosDB.Models.PSCompositePath}
SpatialIndexes   : {Microsoft.Azure.Commands.CosmosDB.Models.PSSpatialSpec}

Parameters

-Automatic

Bool to indicate if the indexing policy is automatic

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-CompositePath

Array of array of objects of type Microsoft.Azure.Commands.CosmosDB.PSCompositePath

Type:PSCompositePath[][]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ExcludedPath

Array of strings containing excludedPath(Specifies a path within a JSON document to be excluded in the Azure Cosmos DB service.) elements.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IncludedPath

Array of strings containing includedPath (Specifies a path within a JSON document to be included in the Azure Cosmos DB service.) elements.

Type:PSIncludedPath[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IndexingMode

indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None'

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SpatialSpec

Array of objects of type Microsoft.Azure.Commands.CosmosDB.PSSpatialSpec

Type:PSSpatialSpec[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Microsoft.Azure.Commands.CosmosDB.Models.PSSqlIndexingPolicy