Share via


IndexingPolicy Constructors

Definition

Overloads

IndexingPolicy()

Initializes a new instance of the IndexingPolicy class for the Azure Cosmos DB service.

IndexingPolicy(Index[])

Initializes a new instance of the IndexingPolicy class with the specified set of indexes as default index specifications for the root path for the Azure Cosmos DB service.

IndexingPolicy()

Initializes a new instance of the IndexingPolicy class for the Azure Cosmos DB service.

public IndexingPolicy ();
Public Sub New ()

Remarks

Indexing mode is set to consistent.

Applies to

IndexingPolicy(Index[])

Initializes a new instance of the IndexingPolicy class with the specified set of indexes as default index specifications for the root path for the Azure Cosmos DB service.

public IndexingPolicy (params Microsoft.Azure.Documents.Index[] defaultIndexOverrides);
new Microsoft.Azure.Documents.IndexingPolicy : Microsoft.Azure.Documents.Index[] -> Microsoft.Azure.Documents.IndexingPolicy
Public Sub New (ParamArray defaultIndexOverrides As Index())

Parameters

defaultIndexOverrides
Index[]

Comma seperated set of indexes that serve as default index specifications for the root path.

Examples

The following example shows how to override the default indexingPolicy for root path:

HashIndex hashIndexOverride = Index.Hash(DataType.String, 5);
RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);
SpatialIndex spatialIndexOverride = Index.Spatial(DataType.Point);

IndexingPolicy indexingPolicy = new IndexingPolicy(hashIndexOverride, rangeIndexOverride, spatialIndexOverride);

If you would like to just override the indexingPolicy for Numbers you can specify just that:

RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);

IndexingPolicy indexingPolicy = new IndexingPolicy(rangeIndexOverride);

See also

Applies to