Sessions APIs

The Sessions APIs enables the management of user sessions. Federate is tracking the number of concurrent user sessions across the cluster. A user session must be specified for each search request with the header X-Federate-Session-Id. A same session id can be reused across multiple search requests.

Permissions: To use the sessions APIs, you must ensure that the following cluster-level actions are granted by the security system:

  • Get: cluster:admin/federate/sessions/get

  • Clear: cluster:admin/federate/sessions/clear

Get Sessions

The Get Sessions API allows to retrieve the list of the current active sessions.

GET /_siren/sessions

The response includes the size of the session pool, the number of active sessions and the list of active session ids:

{
  "size": 5,
  "active": 2,
  "active_sessions_ids" : [ user_1, user_2 ]
}

Clear Sessions

Sessions are automatically removed when the session timeout since the last search request has been exceeded. However, it is recommended to clear the session as soon as the session is not being used anymore in order to free slots in the session pool:

DELETE /_siren/sessions/user_1

or

DELETE /_siren/sessions
{
    "session_id" : "user_1"
}

Multiple session IDs can be passed as a comma separated list of values

DELETE /_siren/sessions/user_1,user_2

or as an array:

DELETE /_siren/sessions
{
    "session_id" : [
      "user_1",
      "user_2"
    ]
}