Create and delete indexes

Updated at:

After you register a DataStore (DS), you can create index tables. An index table corresponds to a physical HBase table. HBase Ganos automatically creates various index tables, such as attribute and spatiotemporal index tables, based on the data types specified in the GeoJSON format.

The syntax for creating an index is as follows:

Configuration parameter

Description

URL

/index/:alias/:index

Method

POST

URL parameters

alias=[alphanumeric] specifies the DS name. index=[alphanumeric] specifies the name of the index table. The name uniquely identifies the index.

Data parameters

points=[Boolean]: Specifies if the layer is a point layer. HBase Ganos optimizes data storage for points. date=[alphanumeric]: Specifies the JSONPath of the time property. This parameter is optional. If this parameter is not specified, a time index is not created. id=[alphanumeric]: Specifies the JSONPath of the feature ID. attr=[alphanumeric]: Specifies the JSONPath of the property for which to create a secondary index. This parameter is optional. If this parameter is not specified, an attribute index is not created. compression=[alphanumeric]: Specifies the compression option. Valid values are gz, lzo, and snappy. This parameter is optional. If this parameter is not specified, the data is not compressed.

Success response

Code: 201

Error response

Code: 400 indicates that the parameters are incomplete.

Example 1: Create an index named my_index in the my_ds DataStore. Set the ID index to the properties.id field.

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

This statement does not create indexes for `date` or `attr`. If a query statement includes time or other properties, a full table scan is triggered.

Example 2: Create an index named my_index in the my_ds DataStore. This example specifies the layer as a point layer, sets the JSONPath of the ID field to properties.id, and sets the date field to properties.dtg. It also creates a secondary index for the `name` field and compresses 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