Manage Indexes

You can manage primary indexes and global secondary indexes through the Couchbase Web Console.

Access the Indexes Screen

To access the Indexes screen, left-click on the tab in the left-hand navigation bar:

indexesTab

An index list, showing a summary of all indexes, is displayed in table format.

indexScreenWithIndexes

Change the Index View

To change the index view, open the view by drop-down list and choose a view.

view by menu
  • index displays all the available indexes in a single list.

  • bucket groups the indexes by bucket.

  • server node groups the indexes by server.

Filter the Indexes

To filter the indexes, type a filter term in the filter indexes box.

Only indexes whose definition contains the filter term are shown.

filter indexes

To remove the filter and display all indexes, click the cross icon ⊗ at the end of the filter indexes box.

Index Summary

The index list displays the following information about each index:

index name

The name of the index or replica.

There may also be one or more indicators after the index name, giving further information:

index indicators
  • partitioned indicates that the index is partitioned.

  • replica n indicates that this is an index replica, where n is the replica ID.

  • stale indicates that the node on which the index or partition is stored is not available.

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.

index margins

Index Administration

To work with an index, click the index row in the indexes list to expand the index row. The index row is a toggle — click the row again to collapse it.

When the index row is expanded, the following extra information is displayed.

index row expanded
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.

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.

Show the Index Statistics

To see statistics for the index, click the Index Stats heading in the expanded index row.

The Index Stats heading is a toggle — click the heading again to hide the statistics.

For details of the index statistics, refer to Index Statistics.

Open the Index Definition

To open the index definition:

  1. Click the Open in Workbench button in the expanded index row.

    The index definition is displayed in the Query workbench.

  2. 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.)

indexInQueryWorkbench

The defining and editing of indexes is performed by means of N1QL. See the N1QL Language Reference for information.

Drop the Index

To drop the index from the bucket:

  1. Click the Drop button in the expanded index row.

    A pop-up message appears, asking if you are sure you want to drop the index.

    drop index
  2. Click Drop Index to drop the index, or Cancel to cancel.

You can also drop an index using the N1QL DROP INDEX or DROP PRIMARY INDEX commands.

Index Summary Statistics

Summary statistics for the index service are displayed in the footer of the Indexes screen.

service stats

For details of the index summary statistics, refer to Index Service Statistics.

Manage Indexes with the CLI

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.

Manage Indexes with the REST API

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.