Primary and Global Secondary Indexes can be managed with Couchbase Web Console.
To access the Indexes screen, left-click on the tab in the left-hand navigation bar:
An index list, showing a summary of all indexes, is displayed in table format.
To change the index view, open the view by drop-down list and choose a view.
index displays all the available indexes in a single list.
bucket groups the indexes by bucket.
server node groups the indexes by server.
To filter the indexes, type a filter term in the filter indexes box.
Only indexes whose definition contains the filter term are shown.
To remove the filter and display all indexes, left-click the cross icon, at the end of the filter indexes box.
The index list displays the following information about each index:
index name. The name of the index. There may also be one or more indicators after the index name, giving further information:
requests/sec. The number of requests per second.
resident ratio. The percentage of the data held in memory.
items. The number of items currently indexed.
data size. The size of indexable data that is maintained for the index or replica.
bucket. (Only displayed if viewing the indexes by index, or by server node.) The bucket for which the index or replica was created.
node. (Only displayed if viewing the indexes by bucket.) The server node on which the index or replica is stored, or a list of the nodes on which index partitions are stored.
status. The current state of the index service on the node on which this index is stored: ready, pause, or warmup.
The color of the left margin of the index row also reflects the current state of the index. For example, the left margin of the index row is green when the index is ready, orange when the index is in warmup, and so on.
To administer an index, left-click the index row in the indexes list, to expand the index row. The index row is a toggle — left-click the row again to collapse it.
When the index row is expanded, the following extra information is displayed.
Definition. The N1QL statement used to define the index.
Storage Mode. The storage mode used by the index service on the node on which this index is stored.
Nodes. (Only displayed for partitioned indexes.) The nodes on which the index partitions are stored, and the number of partitions stored on each node.
Last Scanned. The time and data of the last scan request received for this index. If the index service cannot determine when this index was last scanned, this statistic is not displayed. This may be useful for determining whether this index is currently unused.
Note that this statistic is persisted to disk every 15 minutes, so it is preserved when the indexer restarts.
In addition, when the index row is expanded, the Index Stats heading is also displayed, along with the Open in Workbench and Drop buttons.
To see statistics for the index, left-click the Index Stats heading in the expanded index row.
The Index Stats heading is a toggle — left-click the heading again to hide the statistics.
For details of the index statistics, refer to Index Statistics.
To open the index definition:
Left-click the Open in Workbench button, in the expanded index row.
The index definition is displayed in the Query Workbench.
Modify the index definition as required. (You cannot change the definition of the existing index, but you can create a new index with the modified definition.)
Note that the defining and editing of indexes is performed by means of N1QL. See the N1QL Language Reference for information.
Immediately beneath the Query Editor, three buttons are displayed. These can be used to test queries, and to determine how to design corresponding indexes; so as to maximize query-performance. The buttons are as follows.
When left-clicked on, this executes the query that has been typed into the Query Editor.
For example, type the following query into the Query Editor:
SELECT icao FROM `travel-sample` WHERE name = "SeaPort Airlines";.
This selects every
icao key-value pair from the bucket
travel-sample, where the host document also contains a
name value that is
The Query Editor now appears as follows:
Left-click on the Execute button.
Couchbase Web Console now provides feedback on the ongoing execution of the query.
When query-execution has concluded, the results are duly displayed:
When left-clicked on, this provides an explanation of how query-execution proceeded:
The explanation is now displayed in the Query Results panel:
This indicates the bucket and primary index scan that have been used in the query; as well as the filter applied, and the number of terms returned.
When left-clicked on, this displays advice as to what index or indexes might be created, in order to improve the future performance of the query:
Advice is duly displayed in the Query Results panel:
In this instance, the advice consists of two options; which are, respectively, the creation of a covered index, and the creation of a regular index. To create a covered index, left-click on the corresponding button:
The following notification is now displayed:
Left-click on Continue. When index-creation is completed, the following success-message appears on the Query screen:
Note that in Couchbase Server Community Edition, index-definition support is provided in a slightly different way. The area immediately below the Query Editor appears as follows:
The External Query Advisor link takes the user to an external web-site, where the Query Advisor can be accessed and used.
To drop the index from the bucket:
Left-lick the Drop button in the expanded index row.
A pop-up message appears, asking if you are sure you want to drop the index.
Left-click Drop Index to drop the index, or Cancel to cancel.
Summary statistics for the index service are displayed in the footer of the Indexes screen.
For details of the index summary statistics, refer to Index Service Statistics.
You can manage some index service settings using the CLI. Refer to Index Storage Settings via CLI.
Note that there is no CLI support for the administration of specific indexes. However, you can get index information from the system catalog. Refer to Querying Indexes.
You can also edit or remove indexes using N1QL. Refer to N1QL Language Reference for more details.
You can manage some index service settings using the REST API. Refer to Index Settings via REST.
Note that there is no REST API support for the administration of specific indexes.