Table of Contents

Class HashIndex

Namespace
Microsoft.Azure.Documents
Assembly
Microsoft.Azure.Documents.Client.dll

Represents details of the hash index setting in an Azure Cosmos DB service.

public sealed class HashIndex : Index, ICloneable
Inheritance
HashIndex
Implements
Inherited Members
Extension Methods

Remarks

Can be used to serve queries like: SELECT * FROM docs d WHERE d.prop = 5.

Constructors

HashIndex(DataType)

Initializes a new instance of the HashIndex class with specified DataType for the Azure Cosmos DB service.

public HashIndex(DataType dataType)

Parameters

dataType DataType

Specifies the target data type for the index path specification.

Examples

Here is an example to instantiate HashIndex class passing in the DataType:

HashIndex hashIndex = new HashIndex(DataType.String);
See Also

HashIndex(DataType, short)

Initializes a new instance of the HashIndex class with specified DataType and precision for the Azure Cosmos DB service.

public HashIndex(DataType dataType, short precision)

Parameters

dataType DataType

Specifies the target data type for the index path specification.

precision short

Specifies the precision to be used for the data type associated with this index.

Examples

Here is an example to instantiate HashIndex class passing in the DataType and precision:

HashIndex hashIndex = new HashIndex(DataType.String, 3);
See Also

Properties

DataType

Gets or sets the data type for which this index should be applied in the Azure Cosmos DB service.

public DataType DataType { get; set; }

Property Value

DataType

The data type for which this index should be applied.

Remarks

Refer to Customizing the indexing policy of a collection for valid ranges of values.

Precision

Gets or sets the precision for this particular index in the Azure Cosmos DB service.

public short? Precision { get; set; }

Property Value

short?

The precision for this particular index. Returns null, if not set.

Remarks

Refer to Customizing the indexing policy of a collection for valid ranges of values.

Methods

Clone()

Creates a copy of the hash index for the Azure Cosmos DB service.

public object Clone()

Returns

object

A clone of the hash index.