成功注册 DS 之后就可以创建索引表,索引表在物理上对应的是HBase表。HBase Ganos会根据GeoJson格式所描述的数据类型自动创建不同的索引表,包括属性索引表、时空索引表等。创建索引语法如下:
URL | /index/:alias/:index |
方法 | POST |
URL 参数 | alias=[alphanumeric] ds名称;index=[alphanumeric] 索引表名称,用于唯一标识该索引 |
数据参数 | points=[Boolean] 指定是否为点图层,HBase Ganos对点数据存储会进行优化; date=[alphanumeric] 指定时间属性的JSONPath,可为空(不创建时间索引); id=[alphanumeric] 指定要素 id 的 JSONPath; attr=[alphanumeric] 指定创建二级索引属性的 JSONPath,可为空(不创建属性索引); compression=[alphanumeric] 指定压缩选项,枚举值,为以下任意一个:”gz”,”lzo”,”snappy”。 可为空(不对数据进行压缩) |
成功返回信息 | Code: 201;Content: 空 |
失败返回信息 | Code: 400 - 提供参数不完整;Content: 空 |
示例 1: 在 名为my_ds的DS中建立my_index的索引,并指定 id索引为字段properties.id:
curl \ 'localhost:8080/geoserver/geomesa/geojson/index/my_ds/my_index'\
-d id=properties.id
需要注意的是,该语句没有为date、attr等创建索引,当查询语句中带有时间或其他属性时,将会触发全表扫描。
示例 2: 在 my_ds 中新建my_index索引,指定存储类型为点要素,指定 id 的字段JSONPath 为 properties.id, date 字段为 properties.dtg,并对name字段创建二级索引,并对数据进行压缩。
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
在文档使用中是否遇到以下问题
更多建议
匿名提交