Class CreateQueryIndexOptions

java.lang.Object
com.couchbase.client.java.CommonOptions<CreateQueryIndexOptions>
com.couchbase.client.java.manager.query.CreateQueryIndexOptions

public class CreateQueryIndexOptions extends CommonOptions<CreateQueryIndexOptions>
Allows customizing how a query index is created.
  • Method Details

    • createQueryIndexOptions

      public static CreateQueryIndexOptions createQueryIndexOptions()
      Creates a new instance with default values.
      Returns:
      the instantiated default options.
    • ignoreIfExists

      public CreateQueryIndexOptions ignoreIfExists(boolean ignoreIfExists)
      Set to true if no exception should be thrown if the index already exists (false by default).
      Parameters:
      ignoreIfExists - true if no exception should be thrown if the index already exists.
      Returns:
      this options builder for chaining purposes.
    • numReplicas

      public CreateQueryIndexOptions numReplicas(int numReplicas)
      Configures the number of index replicas.
      Parameters:
      numReplicas - the number of replicas used for this index.
      Returns:
      this options builder for chaining purposes.
    • deferred

      public CreateQueryIndexOptions deferred(boolean deferred)
      If set to true will defer building of this index (false by default).

      If you are creating multiple indexes on the same bucket, you may see improved performance by creating them in deferred mode and then building them all at once. Please use QueryIndexManager.buildDeferredIndexes(String) afterwards to build the deferred indexes.

      Parameters:
      deferred - if building this index should be deferred.
      Returns:
      this options builder for chaining purposes.
    • with

      public CreateQueryIndexOptions with(String optionName, Object optionValue)
      Allows passing in custom options into the N1QL WITH clause for index creation.

      This method should only be used if no other option is available - use with caution!

      Parameters:
      optionName - the name of the WITH option.
      optionValue - the value of the WITH option.
      Returns:
      this options builder for chaining purposes.
    • scopeName

      @Deprecated public CreateQueryIndexOptions scopeName(String scopeName)
      Deprecated.
      `collection.queryIndexes()` should now be used for collection-related query index operations.
      Sets the scope name for this query management operation.

      Please note that if the scope name is set, the collectionName(String) (String)} must also be set.

      Parameters:
      scopeName - the name of the scope.
      Returns:
      this options class for chaining purposes.
    • collectionName

      @Deprecated public CreateQueryIndexOptions collectionName(String collectionName)
      Deprecated.
      `collection.queryIndexes()` should now be used for collection-related query index operations.
      Sets the collection name for this query management operation.

      Please note that if the collection name is set, the scopeName(String) must also be set.

      Parameters:
      collectionName - the name of the collection.
      Returns:
      this options class for chaining purposes.
    • build