Class AsyncCollectionQueryIndexManager

java.lang.Object
com.couchbase.client.java.manager.query.AsyncCollectionQueryIndexManager

@Volatile public class AsyncCollectionQueryIndexManager extends Object
Performs management operations on query indexes at the Collection level.
  • Constructor Details

    • AsyncCollectionQueryIndexManager

      @Internal public AsyncCollectionQueryIndexManager(com.couchbase.client.core.api.query.CoreQueryOps queryOps, com.couchbase.client.core.cnc.RequestTracer requestTracer, com.couchbase.client.core.CoreKeyspace collection)
      Creates a new AsyncCollectionQueryIndexManager.

      This API is not intended to be called by the user directly, use AsyncCollection.queryIndexes() instead.

  • Method Details

    • createIndex

      public CompletableFuture<Void> createIndex(String indexName, Collection<String> fields)
      Creates a named query index on this collection.
      Parameters:
      indexName - the name of the query index.
      fields - the collection of fields that are part of the index.
      Throws:
      com.couchbase.client.core.error.IndexFailureException - if creating the index failed (see reason for details).
      com.couchbase.client.core.error.IndexExistsException - if an index already exists with the given name on this collection.
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • createIndex

      public CompletableFuture<Void> createIndex(String indexName, Collection<String> fields, CreateQueryIndexOptions options)
      Creates a named query index with custom options, on this collection.
      Parameters:
      indexName - the name of the query index.
      fields - the collection of fields that are part of the index.
      options - the custom options to apply.
      Throws:
      com.couchbase.client.core.error.IndexFailureException - if creating the index failed (see reason for details).
      com.couchbase.client.core.error.IndexExistsException - if an index already exists with the given name on this collection.
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • createPrimaryIndex

      public CompletableFuture<Void> createPrimaryIndex()
      Creates a primary query index on this collection.
      Throws:
      com.couchbase.client.core.error.IndexFailureException - if creating the index failed (see reason for details).
      com.couchbase.client.core.error.IndexExistsException - if an index already exists with the given name on this collection.
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • createPrimaryIndex

      public CompletableFuture<Void> createPrimaryIndex(CreatePrimaryQueryIndexOptions options)
      Creates a primary query index with custom options, on this collection.
      Parameters:
      options - the custom options to apply.
      Throws:
      com.couchbase.client.core.error.IndexFailureException - if creating the index failed (see reason for details).
      com.couchbase.client.core.error.IndexExistsException - if an index already exists with the given name on this collection.
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • getAllIndexes

      public CompletableFuture<List<QueryIndex>> getAllIndexes()
      Fetches all indexes on this collection.
      Returns:
      a CompletableFuture completing with a list of (potentially empty) indexes or failed with an error.
      Throws:
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • getAllIndexes

      public CompletableFuture<List<QueryIndex>> getAllIndexes(GetAllQueryIndexesOptions options)
      Fetches all indexes from this collection with custom options.
      Parameters:
      options - the custom options to apply.
      Returns:
      a CompletableFuture completing with a list of (potentially empty) indexes or failed with an error.
      Throws:
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • dropPrimaryIndex

      public CompletableFuture<Void> dropPrimaryIndex()
      Drops the primary index from this collection.
      Throws:
      com.couchbase.client.core.error.IndexNotFoundException - if the index does not exist.
      com.couchbase.client.core.error.IndexFailureException - if dropping the index failed (see reason for details).
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • dropPrimaryIndex

      public CompletableFuture<Void> dropPrimaryIndex(DropPrimaryQueryIndexOptions options)
      Drops the primary index from this collection with custom options.
      Parameters:
      options - the custom options to apply.
      Throws:
      com.couchbase.client.core.error.IndexNotFoundException - if the index does not exist.
      com.couchbase.client.core.error.IndexFailureException - if dropping the index failed (see reason for details).
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • dropIndex

      public CompletableFuture<Void> dropIndex(String indexName)
      Drops a query index from this collection.
      Parameters:
      indexName - the name of the index to drop.
      Throws:
      com.couchbase.client.core.error.IndexNotFoundException - if the index does not exist.
      com.couchbase.client.core.error.IndexFailureException - if dropping the index failed (see reason for details).
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • dropIndex

      public CompletableFuture<Void> dropIndex(String indexName, DropQueryIndexOptions options)
      Drops a query index from this collection with custom options.
      Parameters:
      indexName - the name of the index to drop.
      options - the custom options to apply.
      Throws:
      com.couchbase.client.core.error.IndexNotFoundException - if the index does not exist.
      com.couchbase.client.core.error.IndexFailureException - if dropping the index failed (see reason for details).
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • buildDeferredIndexes

      public CompletableFuture<Void> buildDeferredIndexes()
      Builds all currently deferred indexes on this collection.
      Throws:
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • buildDeferredIndexes

      public CompletableFuture<Void> buildDeferredIndexes(BuildQueryIndexOptions options)
      Builds all currently deferred indexes on this collection, with custom options.
      Parameters:
      options - the custom options to apply.
      Throws:
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • watchIndexes

      public CompletableFuture<Void> watchIndexes(Collection<String> indexNames, Duration timeout)
      Watches/Polls indexes on this collection until they are online.
      Parameters:
      indexNames - the names of the indexes to watch.
      timeout - the maximum amount of time the indexes should be watched.
      Throws:
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.
    • watchIndexes

      public CompletableFuture<Void> watchIndexes(Collection<String> indexNames, Duration timeout, WatchQueryIndexesOptions options)
      Watches/Polls indexes on this collection until they are online with custom options.
      Parameters:
      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.
      Throws:
      com.couchbase.client.core.error.CouchbaseException - if any other generic unhandled/unexpected errors.