Class AsyncQueryIndexManager
- java.lang.Object
-
- com.couchbase.client.java.manager.query.AsyncQueryIndexManager
-
public class AsyncQueryIndexManager extends Object
Performs management operations on query indexes.
-
-
Constructor Summary
Constructors Constructor Description AsyncQueryIndexManager(CoreQueryOps queryOps, RequestTracer requestTracer)Creates a newAsyncQueryIndexManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>buildDeferredIndexes(String bucketName)Builds all currently deferred indexes in the bucket's default collection.CompletableFuture<Void>buildDeferredIndexes(String bucketName, BuildQueryIndexOptions options)Builds all currently deferred indexes in a collection.CompletableFuture<Void>createIndex(String bucketName, String indexName, Collection<String> fields)Creates a named query index.CompletableFuture<Void>createIndex(String bucketName, String indexName, Collection<String> fields, CreateQueryIndexOptions options)Creates a named query index with custom options.CompletableFuture<Void>createPrimaryIndex(String bucketName)Creates a primary query index.CompletableFuture<Void>createPrimaryIndex(String bucketName, CreatePrimaryQueryIndexOptions options)Creates a primary query index with custom options.CompletableFuture<Void>dropIndex(String bucketName, String indexName)Drops a query index from a bucket.CompletableFuture<Void>dropIndex(String bucketName, String indexName, DropQueryIndexOptions options)Drops a query index from a bucket with custom options.CompletableFuture<Void>dropPrimaryIndex(String bucketName)Drops the primary index from a bucket.CompletableFuture<Void>dropPrimaryIndex(String bucketName, DropPrimaryQueryIndexOptions options)Drops the primary index from a bucket with custom options.CompletableFuture<List<QueryIndex>>getAllIndexes(String bucketName)Fetches all indexes from the bucket.CompletableFuture<List<QueryIndex>>getAllIndexes(String bucketName, GetAllQueryIndexesOptions options)Fetches all indexes from the bucket with custom options.CompletableFuture<Void>watchIndexes(String bucketName, Collection<String> indexNames, Duration timeout)Watches/Polls indexes until they are online.CompletableFuture<Void>watchIndexes(String bucketName, Collection<String> indexNames, Duration timeout, WatchQueryIndexesOptions options)Watches/Polls indexes until they are online with custom options.
-
-
-
Constructor Detail
-
AsyncQueryIndexManager
@Internal public AsyncQueryIndexManager(CoreQueryOps queryOps, RequestTracer requestTracer)
Creates a newAsyncQueryIndexManager.This API is not intended to be called by the user directly, use
AsyncCluster.queryIndexes()instead.
-
-
Method Detail
-
createIndex
public CompletableFuture<Void> createIndex(String bucketName, String indexName, Collection<String> fields)
Creates a named query index.By default, this method will create an index on the bucket. If an index needs to be created on a collection, both
CreateQueryIndexOptions.scopeName(String)andCreateQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to create the index on.indexName- the name of the query index.fields- the collection of fields that are part of the index.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexFailureException- (async) if creating the index failed (see reason for details).IndexExistsException- (async) if an index already exists with the given name on the keyspace.CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
createIndex
public CompletableFuture<Void> createIndex(String bucketName, String indexName, Collection<String> fields, CreateQueryIndexOptions options)
Creates a named query index with custom options.By default, this method will create an index on the bucket. If an index needs to be created on a collection, both
CreateQueryIndexOptions.scopeName(String)andCreateQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to create the index on.indexName- the name of the query index.fields- the collection of fields that are part of the index.options- the custom options to apply.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexFailureException- (async) if creating the index failed (see reason for details).IndexExistsException- (async) if an index already exists with the given name on the keyspace.CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
createPrimaryIndex
public CompletableFuture<Void> createPrimaryIndex(String bucketName)
Creates a primary query index.By default, this method will create an index on the bucket. If an index needs to be created on a collection, both
CreatePrimaryQueryIndexOptions.scopeName(String)andCreatePrimaryQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to create the index on.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexFailureException- (async) if creating the index failed (see reason for details).IndexExistsException- (async) if an index already exists with the given name on the keyspace.CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
createPrimaryIndex
public CompletableFuture<Void> createPrimaryIndex(String bucketName, CreatePrimaryQueryIndexOptions options)
Creates a primary query index with custom options.By default, this method will create an index on the bucket. If an index needs to be created on a collection, both
CreatePrimaryQueryIndexOptions.scopeName(String)andCreatePrimaryQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to create the index on.options- the custom options to apply.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexFailureException- (async) if creating the index failed (see reason for details).IndexExistsException- (async) if an index already exists with the given name on the keyspace.CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
getAllIndexes
public CompletableFuture<List<QueryIndex>> getAllIndexes(String bucketName)
Fetches all indexes from the bucket.By default, this method will fetch all index on the bucket. If the indexes should be loaded for a collection, both
GetAllQueryIndexesOptions.scopeName(String)andGetAllQueryIndexesOptions.collectionName(String)must be set. If all indexes for a scope should be loaded, only theGetAllQueryIndexesOptions.scopeName(String)can be set.- Parameters:
bucketName- the name of the bucket to load the indexes from.- Returns:
- a
CompletableFuturecompleting with a list of (potentially empty) indexes or failed with an error. - Throws:
CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
getAllIndexes
public CompletableFuture<List<QueryIndex>> getAllIndexes(String bucketName, GetAllQueryIndexesOptions options)
Fetches all indexes from the bucket with custom options.By default, this method will fetch all index on the bucket. If the indexes should be loaded for a collection, both
GetAllQueryIndexesOptions.scopeName(String)andGetAllQueryIndexesOptions.collectionName(String)must be set. If all indexes for a scope should be loaded, only theGetAllQueryIndexesOptions.scopeName(String)can be set.- Parameters:
bucketName- the name of the bucket to load the indexes from.options- the custom options to apply.- Returns:
- a
CompletableFuturecompleting with a list of (potentially empty) indexes or failed with an error. - Throws:
CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
dropPrimaryIndex
public CompletableFuture<Void> dropPrimaryIndex(String bucketName)
Drops the primary index from a bucket.By default, this method will drop the primary index on the bucket. If the index should be dropped on a collection, both
DropPrimaryQueryIndexOptions.scopeName(String)andDropPrimaryQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to drop the indexes from.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexNotFoundException- (async) if the index does not exist.IndexFailureException- (async) if dropping the index failed (see reason for details).CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
dropPrimaryIndex
public CompletableFuture<Void> dropPrimaryIndex(String bucketName, DropPrimaryQueryIndexOptions options)
Drops the primary index from a bucket with custom options.By default, this method will drop the primary index on the bucket. If the index should be dropped on a collection, both
DropPrimaryQueryIndexOptions.scopeName(String)andDropPrimaryQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to drop the indexes from.options- the custom options to apply.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexNotFoundException- (async) if the index does not exist.IndexFailureException- (async) if dropping the index failed (see reason for details).CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
dropIndex
public CompletableFuture<Void> dropIndex(String bucketName, String indexName)
Drops a query index from a bucket.By default, this method will drop the index on the bucket. If the index should be dropped on a collection, both
DropQueryIndexOptions.scopeName(String)andDropQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to drop the indexes from.indexName- the name of the index top drop.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexNotFoundException- (async) if the index does not exist.IndexFailureException- (async) if dropping the index failed (see reason for details).CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
dropIndex
public CompletableFuture<Void> dropIndex(String bucketName, String indexName, DropQueryIndexOptions options)
Drops a query index from a bucket with custom options.By default, this method will drop the index on the bucket. If the index should be dropped on a collection, both
DropQueryIndexOptions.scopeName(String)andDropQueryIndexOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket to drop the indexes from.indexName- the name of the index top drop.options- the custom options to apply.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
IndexNotFoundException- (async) if the index does not exist.IndexFailureException- (async) if dropping the index failed (see reason for details).CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
buildDeferredIndexes
public CompletableFuture<Void> buildDeferredIndexes(String bucketName)
Builds all currently deferred indexes in the bucket's default collection.To target a different collection, see
buildDeferredIndexes(String, BuildQueryIndexOptions).- Parameters:
bucketName- the name of the bucket to build deferred indexes for.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
buildDeferredIndexes
public CompletableFuture<Void> buildDeferredIndexes(String bucketName, BuildQueryIndexOptions options)
Builds all currently deferred indexes in a collection.By default, this method targets the bucket's default collection. To target a different collection, specify both
BuildQueryIndexOptions.scopeName(String)andBuildQueryIndexOptions.collectionName(String).- Parameters:
bucketName- the name of the bucket to build deferred indexes for.options- the custom options to apply.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
watchIndexes
public CompletableFuture<Void> watchIndexes(String bucketName, Collection<String> indexNames, Duration timeout)
Watches/Polls indexes until they are online.By default, this method will watch the indexes on the bucket. If the indexes should be watched on a collection, both
WatchQueryIndexesOptions.scopeName(String)andWatchQueryIndexesOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket where the indexes should be watched.indexNames- the names of the indexes to watch.timeout- the maximum amount of time the indexes should be watched.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
watchIndexes
public CompletableFuture<Void> watchIndexes(String bucketName, Collection<String> indexNames, Duration timeout, WatchQueryIndexesOptions options)
Watches/Polls indexes until they are online with custom options.By default, this method will watch the indexes on the bucket. If the indexes should be watched on a collection, both
WatchQueryIndexesOptions.scopeName(String)andWatchQueryIndexesOptions.collectionName(String)must be set.- Parameters:
bucketName- the name of the bucket where the indexes should be watched.indexNames- the names of the indexes to watch.timeout- the maximum amount of time the indexes should be watched.options- the custom options to apply.- Returns:
- a
CompletableFuturecompleting when the operation is applied or failed with an error. - Throws:
CouchbaseException- (async) if any other generic unhandled/unexpected errors.
-
-