RNeo4j (version 1.6.4)

addIndex: Indexes

Description

Add an index to a node label and property key.

Usage

addIndex(graph, label, key)

Arguments

graph
A graph object.
label
A character string.
key
A character string.

Details

An index already exists for any (label, key) pair that has a uniqueness constraint applied. Attempting to add an index where a uniqueness constraint already exists results in an error. Use getConstraint to view any pre-existing uniqueness constraints. If a uniqueness constraint already exists for the (label, key) pair, then it must be true that the index exists as well; adding an index is unnecessary.

See Also

getIndex, dropIndex

Examples

Run this code
## Not run: 
# graph = startGraph("http://localhost:7474/db/data/")
# clear(graph)
# 
# createNode(graph, "Person", name="Alice", status="Employed")
# 
# addIndex(graph, "Person", "status")
# ## End(Not run)

Run the code above in your browser using DataLab