Can anyone tell me how to run a PROFILE'd query using teh neo4j REST API such as
PROFILE MATCH (n:LABEL) return n;
When I run this either in Java using the RestCypherQueryEngine or the even using a raw HTTP post directly I get
message: "Invalid input 'P': expected SingleStatement (line 1, column 1) "PROFILE MATCH (n:LABEL) return n;" ^"
exception: "SyntaxException"
I though I had read somewhere that this is possible not only through the server console
解决方案
The old cypher endpoint (i.e /db/data/cypher) had a ?profile=true query parameter that adds profiling information to the result.
e.g.
curl -H accept:application/json -H content-type:application/json
-d'{"query":"MATCH (n) RETURN count(*)","params":{}}'
http://localhost:7474/d/data/cypher?profile=true
{
"columns" : [ "count(*)" ],
"data" : [ [ 0 ] ],
"plan" : {
"args" : {
"returnItemNames" : [ "count(*)" ],
"_rows" : 1,
"_db_hits" : 0,
"symKeys" : [ " INTERNAL_AGGREGATE75acebd9-82d7-4a65-921c-2049c4bde4e7" ]
},
"dbHits" : 0,
"name" : "ColumnFilter",
"children" : [ {
"args" : {
"keys" : [ ],
"_rows" : 1,
"aggregates" : [ "( INTERNAL_AGGREGATE75acebd9-82d7-4a65-921c-2049c4bde4e7,CountStar())" ],
"_db_hits" : 0
},
"dbHits" : 0,
"name" : "EagerAggregation",
"children" : [ {
"args" : {
"_rows" : 0,
"_db_hits" : 0,
"identifier" : "n"
},
"dbHits" : 0,
"name" : "AllNodes",
"children" : [ ],
"rows" : 0
} ],
"rows" : 1
} ],
"rows" : 1
}
}