Class QueryIndex

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

public class QueryIndex extends Object
Contains the properties of a Query Index.
  • Method Details

    • primary

      public boolean primary()
      True if this index is a primary index.
      Returns:
      true if this index is a primary index.
    • name

      public String name()
      Returns the name of this index.
      Returns:
      the name of the index.
    • type

      public String type()
      Returns the index type (most likely "gsi").
      Returns:
      the type of the index.
    • state

      public String state()
      Returns the state in which the index is in (i.e. "online").
      Returns:
      the state of the index.
    • keyspace

      public String keyspace()
      Returns the keyspace of this index.

      If the index is at the bucket-level, this will return the bucket name. If the index is at the collection-level, the keyspace is the name of the collection.

      Returns:
      the keyspace of this index.
    • namespace

      public String namespace()
      Returns the namespace of this index.

      The namespace should not be confused with the keyspace - the namespace usually is "default".

      Returns:
      the namespace of this index.
    • indexKey

      public JsonArray indexKey()
      Returns an array of Strings that represent the index key(s).

      The array is empty in the case of a PRIMARY INDEX.

      Note that the query service can present the key in a slightly different manner from when you declared the index: for instance, it will show the indexed fields in an escaped format (surrounded by backticks).

      Returns:
      an array of Strings that represent the index key(s), or an empty array in the case of a PRIMARY index.
    • condition

      public Optional<String> condition()
      Returns the String representation of the index's condition (the WHERE clause of the index), or an empty Optional if no condition was set.

      Note that the query service can present the condition in a slightly different manner from when you declared the index: for instance it will wrap expressions with parentheses and show the fields in an escaped format (surrounded by backticks).

      Returns:
      the condition/WHERE clause of the index or empty string if none.
    • partition

      public Optional<String> partition()
      If present, returns the configured partition for the index.
      Returns:
      the partition if set, empty if none.
    • scopeName

      public Optional<String> scopeName()
      If present, returns the name of the scope this index is stored in.
      Returns:
      the name of the scope, if present.
    • bucketName

      public String bucketName()
      If present, returns the name of the bucket this index is stored in.
      Returns:
      the name of the bucket, if present.
    • collectionName

      public Optional<String> collectionName()
      If present, returns the name of the collection this index is stored in.
      Returns:
      the name of the collection, if present.
    • raw

      public JsonObject raw()
      Returns the JSON as it arrived from the server.
      Returns:
      the raw JSON representation of the index information, as returned by the query service.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object