Managing Read-Only Mode via API
editManaging Read-Only Mode via API
editThe read-only mode flag for your deployment can be managed with the dedicated Read-Only Management API.
Authentication and Authorization
editTo make a call to one of the Read-Only Management APIs, you need to have a set of Elasticsearch credentials
(username/password) for a user that has a manage
Elasticsearch cluster privilege.
Getting read-only flag state
editIf you need to know if your deployment is in read-only mode, you can perform a GET
call on this
API endpoint. The response will have a single boolean field called enabled
representing the state
of the read-only flag for your deployment.
Here is how you can get the state of the read-only mode on your deployment using a curl
command:
curl -X GET http://localhost:3002/api/ent/v1/internal/read_only_mode \ -H "Content-Type: application/json" \ -u username:password
An example response:
{"enabled":false}
Updating Read-Only Flag
editWhen you want to change the read-only mode flag for your deployment, you need to perform a PUT
call to
the read-only mode API endpoint with the value for the flag you want to set. The response will have
a single boolean field called enabled
representing the state of the read-only flag for your
deployment.
To set the new value for the read-only flag, you can use the following curl
command:
curl -X PUT http://localhost:3002/api/ent/v1/internal/read_only_mode \ -d '{ "enabled": true }' \ -H "Content-Type: application/json" \ -u username:password
An example response:
{"enabled":true}