REST API

The graph REST endpoint allows to interact with the Elasticsearch cluster as if it were a graph search engine.

POST /siren/_graph

Request Parameters

preference

The preference parameter given to the search requests executed over the indices referenced by the entities in the data model.

detailed

A boolean parameter that adds information to the graph response about the execution of the graph request.

debug

Similar to the detailed parameter, but further adds the debug output of the search requests executed to evaluate the graph request.

Request Body

{
  "model": { ... }, (1)
  "query": "..." (2)
}
1 The graph data model.
2 The GQL query.

Response

Currently, only a table response formatted in JSON is available.

{
  "header": [ ... ], (1)
  "rows": [ ... ], (2)
  "query_plan_execution": { ... } (3)
}
1 The header of the table, represented as an array with as many elements as there are selected items in the query.
2 The rows of the table, represented as an array of arrays. One row is an array with the same number of elements as the header. There are as many rows as there are subgraphs matching the query.
3 Statistics about the query execution.

With the graph example of persons, forums, and messages, consider the following query that finds persons connected to forums:

SELECT p.firstName, f.title
FROM "my-graph"
MATCH (p:Person) <- (f:Forum)

This query returns the following graph response:

{
  "header": [ (1)
    "p.firstName",
    "f.title"
  ],
  "rows": [ (2)
    [
      "John", (3)
      "BeatlesFans" (4)
    ],
    [
      "Paul",
      "BeatlesFans"
    ]
  ],
  "query_plan_execution": {
    "took_in_millis": 41, (5)
    "start_in_millis": 1764940688964,
    "stop_in_millis": 1764940689005,
    "steps": [ (6)
      {
        "pattern": "(p:Person)<-[$1:hasMember]-(f:Forum)",
        "rows": 2,
        "took_in_millis": 40,
        "start_in_millis": 1764940688965,
        "stop_in_millis": 1764940689005
      }
    ]
  }
}
1 The query selects two items, therefore the header contains two elements.
2 The graph example contains 2 persons who are forum members, therefore the table has 2 rows.
3 The p.firstName value of the 1st row is John.
4 The f.title value of the 1st row is BeatlesFans.
5 The query took 41ms to complete.
6 Optional array in case the detailed parameter is used.