Searching from the UI
Full Text Search can be performed from the Couchbase Web Console.
Access the Full Text Search User Interface
The user interface for Full Text Search is provided by the Couchbase Web Console. In order to proceed, you must have permission to log into the console, create indexes, and perform searches. For information on Role-Based Access Control, see Authorization.
The example provided in this section assumes that you have also loaded the travel-sample bucket: you will perform your Full Text Search operations on the data in this bucket. For instructions on how to load this sample bucket, see Install Sample Buckets.
Once you have the appropriate credentials, and have loaded the travel-sample bucket, access the Couchbase Web Console by typing http://localhost:8091 into the address-field at the top of your browser, and then hitting return. The login screen appears as follows:
Enter your username and password, and left-click on the Sign In button. The Couchbase Web Console now appears:
To access the Full Text Search screen, left-click on the Search tab, in the navigation bar at the left-hand side:
The Full Text Search screen now appears, as follows:
The console contains areas for the display of indexes and aliases: but both are empty, since none has yet been created.
Create an Index
To create an index, left-click on the Add Index button, towards the right-hand side:
The Add Index screen appears:
To define a basic index on which Full Text Search can be performed, begin by entering a unique name for the index into the Name field, at the upper-left: for example, travel-sample-index. (Note that only alphanumeric characters, hyphens, and underscores are allowed for index names. Note also that the first character of the name must be an alphabetic character.) Then, use the pull-down menu provided for the Bucket field, at the upper-right, to specify the travel-sample bucket:
This is all you need to specify, in order to create a basic index for test and development. No further configuration is required. Note, however, that such default indexing is not recommended for production environments, since it creates indexes that may be unnecessarily large, and therefore insufficiently performant. To review the wide range of available options for creating indexes appropriate for production environments, see Creating Indexes.
To save your index, left-click on the Create Index button, near the bottom of the screen:
At this point, you are returned to the Full Text Search screen. A row now appears, in the Full Text Indexes panel, for the index you have created. When left-clicked on, the row opens as follows:
Note the percentage figure: this appears under the indexing progress column, and is incremented in correspondence with the build-progress of the index. When 100% is reached, the build is complete, and the index ready for use.
Once the the new index has been built, it supports Full Text Searches performed by all available means: the Console UI, the Couchbase REST API, and the Couchbase SDK.
Perform a Query
To perform a query, simply type a term into the interactive text-field that appears to the left of the Search button on the row for the index you have created. For example, restaurant. Then, left-click on the Search button:
A Search Results page now appears, featuring documents that contain the specified term:
By left-clicking on any of the displayed document IDs, you bring up a display that features the entire contents of the document.
Advanced Settings and Other Features
On the Search Results page, to the immediate right of the Search button, at the top of the screen, appears the show advanced query settings checkbox. Check this to display the advanced settings:
Three interactive text-fields now appear underneath the Search panel: Timeout (msecs), Consistency Level, and Consistency Vector. Additionally, the JSON for Query Request panel displays the submitted query in JSON format. Note the show command-line curl example checbox, which when checked, adds to the initial JSON display, to form a completed curl command:
This example can be copied by means of the Copy to Clipboard button, pasted (for example) into a standard console-window, and executed against the prompt. This feature therefore provides a useful means of extending experiments initially performed with the UI into a subsequent console-based, script-based, or program-based context. (Note, however, that the addition of credentials for authentication are required for execution of the statement outside the context of the current session within Couchbase Web Console. See Searching with the REST API for an example.)
Note also the Show Scoring checkbox that appears prior to the entries in the Results for travel-sample-index panel. When this is checked, scores for each document in the list are provided. For example:
Finally, note the full text query syntax help link that now appears under the Search interactive text-field:
This link takes the user to a page of information on Query String Full Text Search queries. Such queries can be specified in the Search interactive text-field, thereby allowing searches of considerable complexity to be accomplished within the Couchbase Web Console. Additional information on Query String searches is also provided in Query Types.