IndexingPolicy Class
- java.
lang. Object - JsonSerializable
- com.
microsoft. azure. cosmosdb. IndexingPolicy
- com.
public class IndexingPolicy extends JsonSerializable
Represents the indexing policy configuration for a collection in the Azure Cosmos DB database service.
Constructor Summary
Constructor | Description |
---|---|
IndexingPolicy() |
Constructor. |
IndexingPolicy(Index[] defaultIndexOverrides) |
Initializes a new instance of the IndexingPolicy class with the specified set of indexes as default index specifications for the root path. The following example shows how to override the default indexingPolicy for root path:
If you would like to just override the indexingPolicy for Numbers you can specify just that:
|
IndexingPolicy(String jsonString) |
Constructor. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Boolean |
getAutomatic()
Gets whether automatic indexing is enabled for a collection. In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual indexing, documents can be explicitly included. |
Collection<ArrayList<Composite |
getCompositeIndexes()
Gets the composite indexes for additional indexes. |
Collection<Excluded |
getExcludedPaths()
Gets the paths that are not indexed. |
Collection<Included |
getIncludedPaths()
Gets the paths that are chosen to be indexed by the user. |
Indexing |
getIndexingMode()
Gets the indexing mode (consistent or lazy). |
Collection<Spatial |
getSpatialIndexes()
Sets the spatial indexes for additional indexes. |
void |
setAutomatic(boolean automatic)
Sets whether automatic indexing is enabled for a collection. In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual indexing, documents can be explicitly included. |
void |
setCompositeIndexes(Collection<ArrayList<CompositePath>> compositeIndexes)
Sets the composite indexes for additional indexes. |
void | setExcludedPaths(Collection<ExcludedPath> excludedPaths) |
void | setIncludedPaths(Collection<IncludedPath> includedPaths) |
void |
setIndexingMode(IndexingMode indexingMode)
Sets the indexing mode (consistent or lazy). |
void |
setSpatialIndexes(Collection<SpatialSpec> spatialIndexes)
Sets the spatial indexes for additional indexes. |
Inherited Members
Constructor Details
IndexingPolicy
public IndexingPolicy()
Constructor.
IndexingPolicy
public IndexingPolicy(Index[] defaultIndexOverrides)
Initializes a new instance of the IndexingPolicy class with the specified set of indexes as default index specifications for the root path.
The following example shows how to override the default indexingPolicy for root path:
HashIndex hashIndexOverride = Index.Hash(DataType.String, 5);
RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);
SpatialIndex spatialIndexOverride = Index.Spatial(DataType.Point);
IndexingPolicy indexingPolicy = new IndexingPolicy(hashIndexOverride, rangeIndexOverride, spatialIndexOverride);
If you would like to just override the indexingPolicy for Numbers you can specify just that:
RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);
IndexingPolicy indexingPolicy = new IndexingPolicy(rangeIndexOverride);
Parameters:
IndexingPolicy
public IndexingPolicy(String jsonString)
Constructor.
Parameters:
Method Details
getAutomatic
public Boolean getAutomatic()
Gets whether automatic indexing is enabled for a collection.
In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual indexing, documents can be explicitly included.
Returns:
getCompositeIndexes
public Collection
Gets the composite indexes for additional indexes.
Returns:
getExcludedPaths
public Collection
Gets the paths that are not indexed.
Returns:
getIncludedPaths
public Collection
Gets the paths that are chosen to be indexed by the user.
Returns:
getIndexingMode
public IndexingMode getIndexingMode()
Gets the indexing mode (consistent or lazy).
Returns:
getSpatialIndexes
public Collection
Sets the spatial indexes for additional indexes.
Returns:
setAutomatic
public void setAutomatic(boolean automatic)
Sets whether automatic indexing is enabled for a collection.
In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual indexing, documents can be explicitly included.
Parameters:
setCompositeIndexes
public void setCompositeIndexes(Collection
Sets the composite indexes for additional indexes.
Parameters:
setExcludedPaths
public void setExcludedPaths(Collection
Parameters:
setIncludedPaths
public void setIncludedPaths(Collection
Parameters:
setIndexingMode
public void setIndexingMode(IndexingMode indexingMode)
Sets the indexing mode (consistent or lazy).
Parameters:
setSpatialIndexes
public void setSpatialIndexes(Collection
Sets the spatial indexes for additional indexes.
Parameters:
Applies to
Azure SDK for Java