CosmosGlobalSecondaryIndexDefinition Class
- java.
lang. Object - com.
azure. cosmos. models. CosmosGlobalSecondaryIndexDefinition
- com.
public final class CosmosGlobalSecondaryIndexDefinition
Represents the global secondary index definition for a container in the Azure Cosmos DB service. A global secondary index is derived from a source container and is defined by a SQL-like query. Once created, the source container id and the query definition are immutable for the lifetime of the global secondary index.
Example:
CosmosGlobalSecondaryIndexDefinition definition =
new CosmosGlobalSecondaryIndexDefinition("gsi-src", "SELECT c.customerId, c.emailAddress FROM c");
Constructor Summary
| Constructor | Description |
|---|---|
| CosmosGlobalSecondaryIndexDefinition(String sourceContainerId, String definition) |
Creates a new global secondary index definition. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| String |
getDefinition()
Gets the query definition for the Global |
| String |
getSourceContainerId()
Gets the source container id for the global secondary index. |
| String |
getSourceContainerRid()
Gets the source container resource id (RID) for the Global |
|
Cosmos |
getStatus()
Gets the build status of the Global |
| String | toString() |
Methods inherited from java.lang.Object
Constructor Details
CosmosGlobalSecondaryIndexDefinition
public CosmosGlobalSecondaryIndexDefinition(String sourceContainerId, String definition)
Creates a new global secondary index definition. The source container id and the query definition are immutable once the definition is created.
Parameters:
"SELECT c.customerId, c.emailAddress FROM c").
Method Details
getDefinition
public String getDefinition()
Gets the query definition for the GlobalSecondaryIndex.
Returns:
getSourceContainerId
public String getSourceContainerId()
Gets the source container id for the global secondary index.
Returns:
getSourceContainerRid
public String getSourceContainerRid()
Gets the source container resource id (RID) for the GlobalSecondaryIndex as returned by the server. This is a read-only field populated from server responses.
Returns:
getStatus
public CosmosGlobalSecondaryIndexBuildStatus getStatus()
Gets the build status of the GlobalSecondaryIndex as returned by the server. This is a read-only field populated from server responses. Returns null when the status field is absent from the server response. When the server returns a value this SDK version does not declare as a known constant, the returned instance still preserves the original wire value via CosmosGlobalSecondaryIndexBuildStatus#toString().
Returns:
null if the server did not return one.toString
public String toString()
Overrides:
CosmosGlobalSecondaryIndexDefinition.toString()