Route queries to read cluster membersNot available on AuraDeprecated in 5.26
|
The transactional HTTP API is deprecated and replaced by the HTTP Query API. See Query API → Route queries to read cluster members for details on how to route queries to read cluster members with the Query API. |
In a cluster environment, all queries are routed to writer members by default.
To ensure efficient load balancing, you should send queries that contain only read statements to the cluster readers.
You can do so by adding the header Access-Mode: READ to the request (the default is WRITE).
|
Query routing is only supported for implicit transactions (i.e. requests to the |
Example request
POST http://localhost:7474/db/neo4j/tx/commit
Accept: application/json;charset=UTF-8
Content-Type: application/json
Authorization: Basic bmVvNGo6dmVyeXNlY3JldA==
Access-Mode: READ
{
"statements": [
{ "statement": "MATCH (n) RETURN n LIMIT 2" }
]
}
Example response
200: OK
Content-Type: application/json;charset=utf-8
{
"results": [ {
"columns": [ "n" ],
"data": [
{
"row": [ {
"name": "Phil",
"age": 21
} ],
"meta": [ {
"id": 12,
"elementId": "4:b7c0e943-1e73-474b-8ddc-e8ff3ae74cdd:12",
"type": "node",
"deleted": false
} ]
},
{
"row": [ {
"name": "Lucy",
"age": 20
} ],
"meta": [ {
"id": 13,
"elementId": "4:b7c0e943-1e73-474b-8ddc-e8ff3ae74cdd:13",
"type": "node",
"deleted": false
} ]
}
]
} ],
"errors": [],
"lastBookmarks": [
"FB:kcwQt8DpQx5zR0uN3Oj/OudM3RmQ"
]
}