命名
普通索引与其所参照的属性同名且同 schema。
查看索引
返回的表名:_nodeIndex
、_edgeIndex
返回的表头:name
|properties
|schema
|status
(索引的名称、参照属性、所属 schema、当前状态 [creating|done])
语法:
// 查看当前图集中的所有索引(分为点、边两个表)
show().index()
// 查看当前图集中的所有点索引
show().node_index()
// 查看当前图集中的所有边索引
show().edge_index()
创建索引
语法:
// 在当前图集中为某个 点schema 的某个属性创建索引
create().node_index(@<schema>.<property>)
// 在当前图集中为所有 点schema 的某个属性(如有)创建索引
create().node_index(@*.<property>)
// 在当前图集中为某个 边schema 的某个属性创建索引
create().edge_index(@<schema>.<property>)
// 在当前图集中为所有 边schema 的某个属性(如有)创建索引
create().edge_index(@*.<property>)
// 混合以上四种方法同时为多个点/边属性创建索引
create()
.node_index(@<schema>.<property>)
.node_index(@*.<property>)
.edge_index(@<schema>.<property>)
.edge_index(@*.<property>)
...
示例:为银行卡 @card 的余额 balance 创建索引
create().node_index(@card.balance)
示例:为交易 @transaction 的金额 amount 创建索引
create().edge_index(@transaction.amount)
删除索引
语法:
// 从当前图集中删除某个 点schema 的某个属性的索引
drop().node_index(@<schema>.<property>)
// 从当前图集中删除所有 点schema 的某个属性(如有)的索引
drop().node_index(@*.<property>)
// 从当前图集中删除某个 边schema 的某个属性的索引
drop().edge_index(@<schema>.<property>)
// 从当前图集中删除所有 边schema 的某个属性(如有)的索引
drop().edge_index(@<schema>.<property>)
// 混合以上四种方法同时删除多个点/边属性的索引
drop()
.node_index(@<schema>.<property>)
.node_index(@*.<property>)
.edge_index(@<schema>.<property>)
.edge_index(@*.<property>)
...
示例:删除对 @card 的余额 balance 的索引
drop().node_index(@card.balance)
示例:删除对 @transaction 的金额 amount 的索引
drop().edge_index(@transaction.amount)