Package com.azure.data.cosmos
Class Index
- java.lang.Object
-
- com.azure.data.cosmos.JsonSerializable
-
- com.azure.data.cosmos.Index
-
- Direct Known Subclasses:
HashIndex
,RangeIndex
public abstract class Index extends JsonSerializable
Represents the index of a collection in the Azure Cosmos DB database service.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HashIndex
Hash(DataType dataType)
Returns an instance of HashIndex class with specified DataType.static HashIndex
Hash(DataType dataType, int precision)
Returns an instance of HashIndex class with specified DataType and precision.IndexKind
kind()
Gets index kind.static RangeIndex
Range(DataType dataType)
Returns an instance of RangeIndex class with specified DataType.static RangeIndex
Range(DataType dataType, int precision)
Returns an instance of RangeIndex class with specified DataType and precision.static com.azure.data.cosmos.SpatialIndex
Spatial(DataType dataType)
Returns an instance of SpatialIndex class with specified DataType.-
Methods inherited from class com.azure.data.cosmos.JsonSerializable
get, getBoolean, getCollection, getDouble, getInt, getList, getLogger, getLong, getMap, getObject, getObjectByPath, getString, has, toJson, toJson, toObject, toString
-
-
-
-
Method Detail
-
Range
public static RangeIndex 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);
- Parameters:
dataType
- the data type.- Returns:
- an instance of RangeIndex type.
-
Range
public static RangeIndex 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);
- Parameters:
dataType
- specifies the target data type for the index path specification.precision
- specifies the precision to be used for the data type associated with this index.- Returns:
- an instance of RangeIndex type.
-
Hash
public static HashIndex 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);
- Parameters:
dataType
- specifies the target data type for the index path specification.- Returns:
- an instance of HashIndex type.
-
Hash
public static HashIndex 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);
- Parameters:
dataType
- specifies the target data type for the index path specification.precision
- specifies the precision to be used for the data type associated with this index.- Returns:
- an instance of HashIndex type.
-
Spatial
public static com.azure.data.cosmos.SpatialIndex 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);
- Parameters:
dataType
- specifies the target data type for the index path specification.- Returns:
- an instance of SpatialIndex type.
-
kind
public IndexKind kind()
Gets index kind.- Returns:
- the index kind.
-
-