Class CreatePrimaryQueryIndexOptions

    • Method Detail

      • 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.
      • collectionName

        @Uncommitted
        public CreatePrimaryQueryIndexOptions collectionName​(String collectionName)
        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.