All Products
Search
Document Center

ApsaraDB for HBase:Create/delete indexes

Last Updated:Jan 22, 2024

After DS is registered, you can create index tables. Index tables correspond to HBase tables. HBase Ganos automatically creates different index tables based on data types in the GeoJson format. These index tables include property index tables and spatio-temporal index tables. The following table lists the syntax to create indexes:

Table 1.

Parameter

Description

URL

/index/:alias/:index

Method

POST

URL parameters

alias=[alphanumeric] specifies the name of DS. index=[alphanumeric] specifies the name of the index table, which is used as the unique identifier of the index.

Data parameters

points=[Boolean] specifies whether it is a point layer. HBase Ganos optimizes point data storage. date=[alpha numeric] specifies the JSONPath of the time attribute and can be null (no time index is created); id=[alpha numeric] to specify the JSONPath of the feature id; attr=[alpha numeric] to specify the JSONPath of the secondary index attribute, which can be null (no attribute indexes are created); compression=[alpha numeric] specifies the compression option. Valid values: gz, lzo, snappy. Empty (data is not compressed)

Success response

Code: 201. Content: empty.

Error response

Code: 400, which indicates that some required parameters are not specified. Content: empty.

Example 1: Create an index named my_index in the DS named my_ds and specify the properties.id column as the id index.

 curl \ 'localhost:8080/geoserver/geomesa/geojson/index/my_ds/my_index'\
    -d id=properties.id        

Note that this statement does not create indexes for date, attr. When there are the time or other properties in the query statement, the query will trigger a full table scan.

Example 2: Create an index named my_index in my_ds, set the storage type to Point, set the JSONPath of ID to properties.id, set the date to properties.dtg, create a secondary index on the name column, and compress the data.

Curl \
'localhost:8080/geoserver/geomesa/geojson/index/my_ds/my_index
    -d id=properties.id  \
    -d points=true \
    -d date=properties.dtg \
    -d attr=properties.name \
    -d compression=gz