Index is the short form of property index. An index has the same name and schema with the property it references.
Show Index
Returned table name: _nodeIndex
, _edgeIndex
Returned table header: name
| properties
| schema
| status
| size
(Name, properties, schema, status [creating|done] and byte length of index)
Syntax:
// To show all indexes in the current graphset (node indexes and edges indexes in separate tables)
show().index()
// To show all node indexes in the current graphset
show().node_index()
// To show all edge indexes in the current graphset
show().edge_index()
You may need to compact the graph in order to see the right size of the index.
Create Index
System properties UID, FROM and TO and custom properties of decimal type do not support index.
Syntax:
// To create index for a certain property of a certain node schema in the current graphset
create().node_index(@<schema>.<property>)
// To create index for a certain property of all node schemas (if has) in the current graphset
create().node_index(@*.<property>)
// To create index for a certain property of a certain edge schema in the current graphset
create().edge_index(@<schema>.<property>)
// To create index for a certain property of all edge schemas (if has) in the current graphset
create().edge_index(@*.<property>)
// To create index for multiple node/edge properties using the four methods above
create()
.node_index(@<schema>.<property>)
.node_index(@*.<property>)
.edge_index(@<schema>.<property>)
.edge_index(@*.<property>)
...
Example: Create index for @card property balance
create().node_index(@card.balance)
Example: Create index for @transaction property amount
create().edge_index(@transaction.amount)
Drop Index
Deleting a property will also delete its index.
Syntax:
// To delete index for a certain property of a certain node schema from the current graphset
drop().node_index(@<schema>.<property>)
// To delete index for a certain property of all node schemas (if has) from the current graphset
drop().node_index(@*, <property>)
// To delete index for a certain property of a certain edge schema from the current graphset
drop().edge_index(@<schema>.<property>)
// To delete index for a certain property of all edge schemas (if has) from the current graphset
drop().edge_index(@*, <property>)
// To delete index for multiple node/edge properties using the four methods above
drop()
.node_index(@<schema>.<property>)
.node_index(@*, <property>)
.edge_index(@<schema>.<property>)
.edge_index(@*, <property>)
...
Example: Delete the index for @card property balance
drop().node_index(@card.balance)
Example: Delete the index for @transaction property amount
drop().edge_index(@transaction.amount)