Search in sources :

Example 11 with AnalyticsOptions

use of com.couchbase.client.java.analytics.AnalyticsOptions in project couchbase-jvm-clients by couchbase.

the class AsyncCluster method analyticsQuery.

/**
 * Performs an Analytics query with custom {@link AnalyticsOptions}.
 *
 * @param statement the Analytics query statement as a raw string.
 * @param options the custom options for this analytics query.
 * @return the {@link AnalyticsResult} once the response arrives successfully.
 */
public CompletableFuture<AnalyticsResult> analyticsQuery(final String statement, final AnalyticsOptions options) {
    notNull(options, "AnalyticsOptions", () -> new ReducedAnalyticsErrorContext(statement));
    AnalyticsOptions.Built opts = options.build();
    JsonSerializer serializer = opts.serializer() == null ? environment.get().jsonSerializer() : opts.serializer();
    return AnalyticsAccessor.analyticsQueryAsync(core, analyticsRequest(statement, opts), serializer);
}
Also used : ReducedAnalyticsErrorContext(com.couchbase.client.core.error.context.ReducedAnalyticsErrorContext) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer) AnalyticsOptions(com.couchbase.client.java.analytics.AnalyticsOptions)

Example 12 with AnalyticsOptions

use of com.couchbase.client.java.analytics.AnalyticsOptions in project couchbase-jvm-clients by couchbase.

the class AsyncAnalyticsIndexManager method exec.

/**
 * Executes a statement with options against analytics.
 *
 * @param statement the statement of the query.
 * @param options the options that should be passed along.
 * @param spanName the name of the span as the outer parent.
 * @return a future eventually containing the analytics result once complete, or a failure.
 */
private CompletableFuture<AnalyticsResult> exec(final String statement, final CommonOptions<?>.BuiltCommonOptions options, final String spanName) {
    RequestSpan parent = CbTracing.newSpan(cluster.environment().requestTracer(), spanName, options.parentSpan().orElse(null));
    final AnalyticsOptions analyticsOptions = toAnalyticsOptions(options).parentSpan(parent);
    return cluster.analyticsQuery(statement, analyticsOptions).whenComplete((r, t) -> parent.end());
}
Also used : GetLinksAnalyticsOptions.getLinksAnalyticsOptions(com.couchbase.client.java.manager.analytics.GetLinksAnalyticsOptions.getLinksAnalyticsOptions) ReplaceLinkAnalyticsOptions.replaceLinkAnalyticsOptions(com.couchbase.client.java.manager.analytics.ReplaceLinkAnalyticsOptions.replaceLinkAnalyticsOptions) GetAllIndexesAnalyticsOptions.getAllIndexesAnalyticsOptions(com.couchbase.client.java.manager.analytics.GetAllIndexesAnalyticsOptions.getAllIndexesAnalyticsOptions) CreateLinkAnalyticsOptions.createLinkAnalyticsOptions(com.couchbase.client.java.manager.analytics.CreateLinkAnalyticsOptions.createLinkAnalyticsOptions) CreateIndexAnalyticsOptions.createIndexAnalyticsOptions(com.couchbase.client.java.manager.analytics.CreateIndexAnalyticsOptions.createIndexAnalyticsOptions) DropLinkAnalyticsOptions.dropLinkAnalyticsOptions(com.couchbase.client.java.manager.analytics.DropLinkAnalyticsOptions.dropLinkAnalyticsOptions) DisconnectLinkAnalyticsOptions.disconnectLinkAnalyticsOptions(com.couchbase.client.java.manager.analytics.DisconnectLinkAnalyticsOptions.disconnectLinkAnalyticsOptions) DropDatasetAnalyticsOptions.dropDatasetAnalyticsOptions(com.couchbase.client.java.manager.analytics.DropDatasetAnalyticsOptions.dropDatasetAnalyticsOptions) AnalyticsOptions(com.couchbase.client.java.analytics.AnalyticsOptions) GetAllDataversesAnalyticsOptions.getAllDataversesAnalyticsOptions(com.couchbase.client.java.manager.analytics.GetAllDataversesAnalyticsOptions.getAllDataversesAnalyticsOptions) CreateDatasetAnalyticsOptions.createDatasetAnalyticsOptions(com.couchbase.client.java.manager.analytics.CreateDatasetAnalyticsOptions.createDatasetAnalyticsOptions) GetAllDatasetsAnalyticsOptions.getAllDatasetsAnalyticsOptions(com.couchbase.client.java.manager.analytics.GetAllDatasetsAnalyticsOptions.getAllDatasetsAnalyticsOptions) ConnectLinkAnalyticsOptions.connectLinkAnalyticsOptions(com.couchbase.client.java.manager.analytics.ConnectLinkAnalyticsOptions.connectLinkAnalyticsOptions) DropDataverseAnalyticsOptions.dropDataverseAnalyticsOptions(com.couchbase.client.java.manager.analytics.DropDataverseAnalyticsOptions.dropDataverseAnalyticsOptions) GetPendingMutationsAnalyticsOptions.getPendingMutationsAnalyticsOptions(com.couchbase.client.java.manager.analytics.GetPendingMutationsAnalyticsOptions.getPendingMutationsAnalyticsOptions) CreateDataverseAnalyticsOptions.createDataverseAnalyticsOptions(com.couchbase.client.java.manager.analytics.CreateDataverseAnalyticsOptions.createDataverseAnalyticsOptions) DropIndexAnalyticsOptions.dropIndexAnalyticsOptions(com.couchbase.client.java.manager.analytics.DropIndexAnalyticsOptions.dropIndexAnalyticsOptions) RequestSpan(com.couchbase.client.core.cnc.RequestSpan)

Aggregations

AnalyticsOptions (com.couchbase.client.java.analytics.AnalyticsOptions)12 Disabled (org.junit.jupiter.api.Disabled)6 Test (org.junit.jupiter.api.Test)6 Airport (org.springframework.data.couchbase.domain.Airport)6 ReducedAnalyticsErrorContext (com.couchbase.client.core.error.context.ReducedAnalyticsErrorContext)4 JsonSerializer (com.couchbase.client.java.codec.JsonSerializer)4 ConnectLinkAnalyticsOptions.connectLinkAnalyticsOptions (com.couchbase.client.java.manager.analytics.ConnectLinkAnalyticsOptions.connectLinkAnalyticsOptions)2 CreateDatasetAnalyticsOptions.createDatasetAnalyticsOptions (com.couchbase.client.java.manager.analytics.CreateDatasetAnalyticsOptions.createDatasetAnalyticsOptions)2 CreateDataverseAnalyticsOptions.createDataverseAnalyticsOptions (com.couchbase.client.java.manager.analytics.CreateDataverseAnalyticsOptions.createDataverseAnalyticsOptions)2 CreateIndexAnalyticsOptions.createIndexAnalyticsOptions (com.couchbase.client.java.manager.analytics.CreateIndexAnalyticsOptions.createIndexAnalyticsOptions)2 CreateLinkAnalyticsOptions.createLinkAnalyticsOptions (com.couchbase.client.java.manager.analytics.CreateLinkAnalyticsOptions.createLinkAnalyticsOptions)2 DisconnectLinkAnalyticsOptions.disconnectLinkAnalyticsOptions (com.couchbase.client.java.manager.analytics.DisconnectLinkAnalyticsOptions.disconnectLinkAnalyticsOptions)2 DropDatasetAnalyticsOptions.dropDatasetAnalyticsOptions (com.couchbase.client.java.manager.analytics.DropDatasetAnalyticsOptions.dropDatasetAnalyticsOptions)2 DropDataverseAnalyticsOptions.dropDataverseAnalyticsOptions (com.couchbase.client.java.manager.analytics.DropDataverseAnalyticsOptions.dropDataverseAnalyticsOptions)2 DropIndexAnalyticsOptions.dropIndexAnalyticsOptions (com.couchbase.client.java.manager.analytics.DropIndexAnalyticsOptions.dropIndexAnalyticsOptions)2 DropLinkAnalyticsOptions.dropLinkAnalyticsOptions (com.couchbase.client.java.manager.analytics.DropLinkAnalyticsOptions.dropLinkAnalyticsOptions)2 GetAllDatasetsAnalyticsOptions.getAllDatasetsAnalyticsOptions (com.couchbase.client.java.manager.analytics.GetAllDatasetsAnalyticsOptions.getAllDatasetsAnalyticsOptions)2 GetAllDataversesAnalyticsOptions.getAllDataversesAnalyticsOptions (com.couchbase.client.java.manager.analytics.GetAllDataversesAnalyticsOptions.getAllDataversesAnalyticsOptions)2 GetAllIndexesAnalyticsOptions.getAllIndexesAnalyticsOptions (com.couchbase.client.java.manager.analytics.GetAllIndexesAnalyticsOptions.getAllIndexesAnalyticsOptions)2 GetLinksAnalyticsOptions.getLinksAnalyticsOptions (com.couchbase.client.java.manager.analytics.GetLinksAnalyticsOptions.getLinksAnalyticsOptions)2