Class CreatePrimaryQueryIndexOptions

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

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

    • createPrimaryQueryIndexOptions

      public static CreatePrimaryQueryIndexOptions createPrimaryQueryIndexOptions()
      Creates a new instance with default values.
      Returns:
      the instantiated default options.
    • indexName

      public CreatePrimaryQueryIndexOptions indexName(String indexName)
      The custom name of the primary index.
      Parameters:
      indexName - the custom name of the primary index.
      Returns:
      this options builder for chaining purposes.
    • ignoreIfExists

      public CreatePrimaryQueryIndexOptions ignoreIfExists(boolean ignoreIfExists)
      Set to true if no exception should be thrown if the primary 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 CreatePrimaryQueryIndexOptions 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 CreatePrimaryQueryIndexOptions 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 CreatePrimaryQueryIndexOptions 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 CreatePrimaryQueryIndexOptions 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 CreatePrimaryQueryIndexOptions 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