Package com.couchbase.client.java
Class Cluster
- java.lang.Object
-
- com.couchbase.client.java.Cluster
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AnalyticsResult
analyticsQuery(String statement)
Performs an analytics query with defaultAnalyticsOptions
.AnalyticsResult
analyticsQuery(String statement, AnalyticsOptions options)
Performs an analytics query with customAnalyticsOptions
.AsyncCluster
async()
Provides access to the underlyingAsyncCluster
.Bucket
bucket(String name)
Opens aBucket
with the given name.static Cluster
connect(ClusterEnvironment environment)
Connect to a Couchbase cluster with a customClusterEnvironment
.static Cluster
connect(String connectionString, Credentials credentials)
Connect to a Couchbase cluster with customCredentials
.static Cluster
connect(String connectionString, String username, String password)
Connect to a Couchbase cluster with a username and a password as credentials.Core
core()
Provides access to the underlyingCore
.ClusterEnvironment
environment()
Provides access to the configuredClusterEnvironment
for this cluster.QueryResult
query(String statement)
Performs a N1QL query with defaultQueryOptions
.QueryResult
query(String statement, QueryOptions options)
Performs a N1QL query with customQueryOptions
.ReactiveCluster
reactive()
Provides access to the relatedReactiveCluster
.SearchIndexManager
searchIndexes()
Provides access to the index management capabilities.SearchResult
searchQuery(SearchQuery query)
Performs a Full Text Search (FTS) query with defaultSearchOptions
.SearchResult
searchQuery(SearchQuery query, SearchOptions options)
Performs a Full Text Search (FTS) query with customSearchOptions
.void
shutdown()
Performs a non-reversible shutdown of thisCluster
.
-
-
-
Method Detail
-
connect
public static Cluster connect(String connectionString, String username, String password)
Connect to a Couchbase cluster with a username and a password as credentials.- Parameters:
connectionString
- connection string used to locate the Couchbase cluster.username
- the name of the user with appropriate permissions on the cluster.password
- the password of the user with appropriate permissions on the cluster.- Returns:
- if properly connected, returns a
Cluster
.
-
connect
public static Cluster connect(String connectionString, Credentials credentials)
Connect to a Couchbase cluster with customCredentials
.- Parameters:
connectionString
- connection string used to locate the Couchbase cluster.credentials
- custom credentials used when connecting to the cluster.- Returns:
- if properly connected, returns a
Cluster
.
-
connect
public static Cluster connect(ClusterEnvironment environment)
Connect to a Couchbase cluster with a customClusterEnvironment
.- Parameters:
environment
- the custom environment with its properties used to connect to the cluster.- Returns:
- if properly connected, returns a
Cluster
.
-
async
public AsyncCluster async()
Provides access to the underlyingAsyncCluster
.
-
reactive
public ReactiveCluster reactive()
Provides access to the relatedReactiveCluster
.
-
core
@Uncommitted public Core core()
Provides access to the underlyingCore
.This is advanced API, use with care!
-
searchIndexes
public SearchIndexManager searchIndexes()
Provides access to the index management capabilities.
-
environment
public ClusterEnvironment environment()
Provides access to the configuredClusterEnvironment
for this cluster.
-
query
public QueryResult query(String statement)
Performs a N1QL query with defaultQueryOptions
.- Parameters:
statement
- the N1QL query statement as a raw string.- Returns:
- the
QueryResult
once the response arrives successfully.
-
query
public QueryResult query(String statement, QueryOptions options)
Performs a N1QL query with customQueryOptions
.- Parameters:
statement
- the N1QL query statement as a raw string.options
- the custom options for this query.- Returns:
- the
QueryResult
once the response arrives successfully.
-
analyticsQuery
public AnalyticsResult analyticsQuery(String statement)
Performs an analytics query with defaultAnalyticsOptions
.- Parameters:
statement
- the query statement as a raw string.- Returns:
- the
AnalyticsResult
once the response arrives successfully.
-
analyticsQuery
public AnalyticsResult analyticsQuery(String statement, AnalyticsOptions options)
Performs an analytics query with customAnalyticsOptions
.- Parameters:
statement
- the query statement as a raw string.options
- the custom options for this query.- Returns:
- the
AnalyticsResult
once the response arrives successfully.
-
searchQuery
public SearchResult searchQuery(SearchQuery query)
Performs a Full Text Search (FTS) query with defaultSearchOptions
.- Parameters:
query
- the query, in the form of aSearchQuery
- Returns:
- the
SearchRequest
once the response arrives successfully.
-
searchQuery
public SearchResult searchQuery(SearchQuery query, SearchOptions options)
Performs a Full Text Search (FTS) query with customSearchOptions
.- Parameters:
query
- the query, in the form of aSearchQuery
options
- the custom options for this query.- Returns:
- the
SearchRequest
once the response arrives successfully.
-
bucket
public Bucket bucket(String name)
Opens aBucket
with the given name.- Parameters:
name
- the name of the bucket to open.- Returns:
- a
Bucket
once opened.
-
shutdown
public void shutdown()
Performs a non-reversible shutdown of thisCluster
.
-
-