Running Queries

You can run queries using the Analytics Workbench, the command line query tool, cbq; or directly through the REST API.

Using the Analytics Workbench

A custom standalone Analytics Workbench is available with the Developer Preview.

Open a browser and go to http://localhost:8095 to access the Analytics Workbench.

We recommend Google Chrome or Mozilla Firefox browsers.

Note: For the Docker image, the URL may be different as explained in the
Using Docker section.

Enter the following test query and click Execute:

SELECT "Hello, beer!" AS greeting;

Note: You must press the
Execute button in the Analytics Workbench; unlike Query Workbench, pressing
Enter or
Return will not immediately execute a statement because Analytics accepts multi-line statements.

Using the Command Line Query Tool

You can use the command line tool, cbq, to run queries. The cbq is the command line shell for executing queries against Couchbase Server. Analytics contains a special version of cbq that works with the analytics service and can execute multi-line statements. Make sure you use the version of cbq located in your Analytics install folder.

Run cbq with the following options:

-b=on - enables batch-mode which is required to send multi-line statements as a batch.

-e http://127.0.0.1:8095/ - specifies the host and port for the query service.