Edit

Share via


New-AzCosmosDBSqlIndexingPolicy

Creates a new CosmosDB Sql IndexingPolicy object.

Syntax

Default (Default)

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

Description

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

Examples

Example 1

$ipath1 = New-AzCosmosDBSqlIncludedPathIndex -DataType String -Precision -1 -Kind Hash
$ipath2 = New-AzCosmosDBSqlIncludedPathIndex -DataType String -Precision -1 -Kind Hash
$IncludedPath = New-AzCosmosDBSqlIncludedPath -Path "/*" -Index $ipath1, $ipath2
$SpatialSpec = New-AzCosmosDBSqlSpatialSpec -Path  "/mySpatialPath/*" -Type  "Point", "LineString", "Polygon", "MultiPolygon"
$cp1 = New-AzCosmosDBSqlCompositePath -Path "/abc" -Order Ascending
$cp2 = New-AzCosmosDBSqlCompositePath -Path "/aberc" -Order Descending
$compositePath = (($cp1, $cp2), ($cp2, $cp1))
$VectorIndex = New-AzCosmosDBSqlVectorIndex -Path "/vector1" -Type "flat"
New-AzCosmosDBSqlIndexingPolicy -IncludedPath $IncludedPath -SpatialSpec $SpatialSpec -CompositePath $compositePath -ExcludedPath "/myPathToNotIndex/*" -Automatic 1 -IndexingMode Consistent -VectorIndex $VectorIndex
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}
VectorIndexes    : {Microsoft.Azure.Commands.CosmosDB.Models.PSSqlVectorIndex}

Parameters

-Automatic

Bool to indicate if the indexing policy is automatic

Parameter properties

Type:

Nullable<T>[Boolean]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CompositePath

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

Parameter properties

Type:

PSCompositePath[][]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExcludedPath

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludedPath

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

Parameter properties

Type:

PSIncludedPath[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IndexingMode

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SpatialSpec

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

Parameter properties

Type:

PSSpatialSpec[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VectorIndex

Array of objects of type Microsoft.Azure.Commands.CosmosDB.Models.PSSqlVectorIndex.

Parameter properties

Type:

PSVectorIndex[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

PSSqlIndexingPolicy