Index Class

Definition

Represents the index of a collection in the Azure Cosmos DB database service.

public class Index extends JsonSerializable
Inheritance
java.lang.Object
Serializable
Index

Inherited Members

Constructors

Index(IndexKind indexKind)

Constructor.

Index(JSONObject jsonObject, IndexKind indexKind)

Constructor.

Index(String jsonString, IndexKind indexKind)

Constructor.

Methods

getKind()

Gets index kind.

Hash(DataType dataType)

Returns an instance of HashIndex class with specified DataType.

Here is an example to create HashIndex instance passing in the DataType:

HashIndex hashIndex = Index.Hash(DataType.String);
    

Hash(DataType dataType, int precision)

Returns an instance of HashIndex class with specified DataType and precision.

Here is an example to create HashIndex instance passing in the DataType and precision:

HashIndex hashIndex = Index.Hash(DataType.String, 3);

Range(DataType dataType)

Returns an instance of RangeIndex class with specified DataType.

Here is an example to create RangeIndex instance passing in the DataType:

RangeIndex rangeIndex = Index.Range(DataType.Number);
    

Range(DataType dataType, int precision)

Returns an instance of RangeIndex class with specified DataType and precision.

Here is an example to create RangeIndex instance passing in the DataType and precision:

RangeIndex rangeIndex = Index.Range(DataType.Number, -1);
    

Spatial(DataType dataType)

Returns an instance of SpatialIndex class with specified DataType.

Here is an example to create SpatialIndex instance passing in the DataType:

SpatialIndex spatialIndex = Index.Spatial(DataType.Point);

Applies to