Updated on 2024-10-25 GMT+08:00

Introduction to HBase Global Secondary Index APIs

APIs that use global indexes are in the org.apache.hadoop.hbase.hindex.global.GlobalIndexAdmin class. Related APIs are described as follows:

Operation

API

Description

Adding an index

addIndices()

Add an index to a table without data. Calling this API will add the specified index to a table but skips index data generation. This API is used to add indexes in batches to a table that contains a large amount of pre-existing user data and use the GlobalTableIndexer tool to build index data.

addIndicesWithData()

Add an index to a table with data. This API is used to add the specified index to the table and create index data for the existing user data. Alternatively, the API can be called to generate an index and then generate index data when the user data is being stored. This API is not recommended when a data table contains a large amount of data.

Deleting a collection

dropIndices()

If only the index is deleted, both the index metadata and index data are deleted. After this operation, the index cannot be used for scan or filter operations.

Modifying the Index Status

alterGlobalIndicesUnusable()

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

alterGlobalIndicesActive()

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

alterGlobalIndicesInactive()

This API is used to disable a specified index and cancel index data generation. It cannot be used for scan or filter operations. It is usually used in the index repair process.

Viewing the created index

listIndices()

It can be used to list all indexes in a given table.