Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.74 KB

README.rst

File metadata and controls

40 lines (26 loc) · 1.74 KB

Neo4j ValueContext Plugin

Numeric index values in Neo4j can be manipulated trivially using ValueContext, but this functionality is not currently exposed to the REST API. Neo4j ValueContext Plugin extends the Neo4j REST service to permit indexing of numeric values.

Nodes and relationships can be indexed with types int, long, float, and double.

Example Usage

Create a "time" index:

curl -X DELETE http://localhost:7474/db/data/index/node/time
curl -X POST -H Accept:application/json -HContent-Type:application/json -d \
  '{"name":"time", "config":{"type":"exact","provider":"lucene"}}' \
  http://localhost:7474/db/data/index/node

Give the reference node a timestamp value of 25:

curl -H Accept:application/json http://localhost:7474/db/data/ext/ValueContextPlugin/node/0/post_long \
  -H "Content-Type: application/json" -d '{"index": "time", "key":"timestamp", "value":25}'

Query the time index for nodes with timestamps between 1 and 8. The result is empty because 25 ∉ [1, 8]:

curl -H Accept:application/json http://localhost:7474/db/data/ext/ValueContextPlugin/graphdb/get_long_range_node \
  -H "Content-Type: application/json" -d '{"index": "time", "key":"timestamp", "min":1, "max":8}'

Query the time index for nodes with timestamps between 8 and 30. The result contains the ref node because 25 ∈ [8, 30]:

curl -H Accept:application/json http://localhost:7474/db/data/ext/ValueContextPlugin/graphdb/get_long_range_node \
  -H "Content-Type: application/json" -d '{"index": "time", "key":"timestamp", "min":8, "max":30}'