Package com.azure.cosmos.models
Class CosmosGlobalSecondaryIndexDefinition
java.lang.Object
com.azure.cosmos.models.CosmosGlobalSecondaryIndexDefinition
@Beta(value=V4_81_0,
warningText="Preview API - subject to change in non-backwards compatible way")
public final class CosmosGlobalSecondaryIndexDefinition
extends Object
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
ConstructorsConstructorDescriptionCosmosGlobalSecondaryIndexDefinition(String sourceContainerId, String definition) Creates a new global secondary index definition. -
Method Summary
Modifier and TypeMethodDescriptionGets the query definition for the GlobalSecondaryIndex.Gets the source container id for the global secondary index.Gets the source container resource id (RID) for the GlobalSecondaryIndex as returned by the server.Gets the build status of the GlobalSecondaryIndex as returned by the server.toString()
-
Constructor Details
-
CosmosGlobalSecondaryIndexDefinition
@Beta(value=V4_81_0, warningText="Preview API - subject to change in non-backwards compatible way") 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:
sourceContainerId- the id of the source container from which this global secondary index is derived. The SDK will automatically resolve this container id to its resource id (RID) during container creation.definition- the SQL-like query definition (e.g."SELECT c.customerId, c.emailAddress FROM c").- Throws:
IllegalArgumentException- ifsourceContainerIdordefinitionisnullor empty.
-
-
Method Details
-
getSourceContainerId
@Beta(value=V4_81_0, warningText="Preview API - subject to change in non-backwards compatible way") public String getSourceContainerId()Gets the source container id for the global secondary index.- Returns:
- the source container id.
-
getSourceContainerRid
@Beta(value=V4_81_0, warningText="Preview API - subject to change in non-backwards compatible way") 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:
- the source container resource id.
-
getStatus
@Beta(value=V4_81_0, warningText="Preview API - subject to change in non-backwards compatible way") 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. Returnsnullwhen 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 viaExpandableStringEnum.toString().- Returns:
- the GlobalSecondaryIndex build status, or
nullif the server did not return one.
-
getDefinition
@Beta(value=V4_81_0, warningText="Preview API - subject to change in non-backwards compatible way") public String getDefinition()Gets the query definition for the GlobalSecondaryIndex.- Returns:
- the query definition.
-
toString
-