你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Index Class
- java.
lang. Object - com.
microsoft. azure. documentdb. JsonSerializable - com.
microsoft. azure. documentdb. Index
- com.
- com.
public abstract class Index
extends JsonSerializable
Represents the index of a collection in the Azure Cosmos DB database service.
Constructor Summary
Modifier | Constructor | Description |
---|---|---|
protected | Index(IndexKind indexKind) |
Constructor. |
protected | Index(String jsonString, IndexKind indexKind) |
Constructor. |
protected | Index(JSONObject jsonObject, IndexKind indexKind) |
Constructor. |
Method Summary
Modifier and Type | Method and Description |
---|---|
static
Hash |
Hash(DataType dataType)
Returns an instance of Hash |
static
Hash |
Hash(DataType dataType, int precision)
Returns an instance of Hash |
static
Range |
Range(DataType dataType)
Returns an instance of Range |
static
Range |
Range(DataType dataType, int precision)
Returns an instance of Range |
static
Spatial |
Spatial(DataType dataType)
Returns an instance of Spatial |
Index |
getKind()
Gets index kind. |
Methods inherited from JsonSerializable
Methods inherited from java.lang.Object
Constructor Details
Index
protected Index(IndexKind indexKind)
Constructor.
Parameters:
Index
protected Index(String jsonString, IndexKind indexKind)
Constructor.
Parameters:
Index
protected Index(JSONObject jsonObject, IndexKind indexKind)
Constructor.
Parameters:
Method Details
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:
Returns:
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:
Returns:
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:
Returns:
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:
Returns:
Spatial
public static 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:
Returns:
getKind
public IndexKind getKind()
Gets index kind.
Returns: