Updated on 2024-04-29 GMT+08:00

GSI APIs

APIs that use global indexes are packed in the org.apache.hadoop.hbase.hindex.global.GlobalIndexAdmin class. Related APIs are listed in the following table.

Operation

API

Description

Adding an index

addIndices()

Adds a specified index to an empty table but skips index data generation. You can use this API to add indexes in batches to a table that contains a large amount of data and use the GlobalTableIndexer tool to build index data.

addIndicesWithData()

Adds a specified index to a table that contains data and generates index data for existing table data. You can call this API to generate an index and then generate index data when table data is being stored. This API is not recommended when a data table contains a large amount of data.

Deleting an index

dropIndices()

Deletes both index metadata and index data. After deletion, the index cannot be used for scan or filter operations.

Changing index status

alterGlobalIndicesUnusable()

Disables a specified index so that it cannot be used for the scan or filter operation.

alterGlobalIndicesActive()

Enables an index specified by the user so that it can be used for the scan or filter operation.

alterGlobalIndicesInactive()

Disables a specified index and skips index data generation so that it cannot be used for the scan or filter operation. This API is usually used for index data re-building.

Viewing created indexes

listIndices()

Lists all indexes in a given table.