Applying a new plan: Checking on progress

Applying a plan change means changing the configuration of a deployment. For smaller deployments, plan changes might take only a minute, but larger deployments might take quite a while, especially if data needs to be migrated to new nodes.

Switching to the Cloud UI to check on progress is not feasible if you plan to use the RESTful API for automation, so the API also lets you check on the progress of pending plan changes:

curl -k -X GET -u $USER:$PASSWORD https://$COORDINATOR_HOST:12443/api/v1/clusters/elasticsearch/$ELASTICSEARCH_CLUSTER_ID/plan/pending
{
  "zone_count": 3,
  "cluster_topology": [{
    "node_type": {

    },
    "memory_per_node": 4096,
    "node_count_per_zone": 1,
    "node_configuration": "default"
  }],
  "elasticsearch": {
    "version": "6.5.4",
    "system_settings": {
      "use_disk_threshold": true
    }
  },
  "deployment_template": {
    "id": "default"
  }
}

A user with sufficient privileges, such as the admin user

The password for the user

A host that you installed Elastic Cloud Enterprise on that holds the coordinator role

The Elasticsearch cluster ID as shown in the Cloud UI or obtained via the API

The JSON with the cluster configuration that gets returned is the plan that is currently pending, in this case the plan from our previous example. After the configuration change has been completed, there will no longer be a pending plan and the same call will return an error (if you also specify -v with curl the error code returned is 412 Precondition Failed):

curl -k -X GET -u $USER:$PASSWORD https://$COORDINATOR_HOST:12443/api/v1/clusters/elasticsearch/$ELASTICSEARCH_CLUSTER_ID/plan/pending
{
  "errors": [{
    "code": "clusters.cluster_plan_state_error",
    "message": "This cluster ([ELASTICSEARCH_CLUSTER_ID]) has no pending plan active"
  }]
}

For long-running changes that might involve large clusters, this "yes" or "no" answer to the question whether there are still pending configuration changes might not always be sufficiently granular. If you need more detailed information, you can also get the activity log returned back to you:

curl -k -X GET -u $USER:$PASSWORD https://$COORDINATOR_HOST:12443/api/v1/clusters/elasticsearch/$ELASTICSEARCH_CLUSTER_ID/plan/activity?show_plan_logs=true

Beware that the activity log can be quite long, as it lists every step in the deployment configuration process. To simplify the output, you can grep on "message": "Completed step: to get the highlights of how each step in the plan is getting applied. The output will look similar to this very abridged example:

"message": "Starting step: [plan-validator]: [cluster=ElasticsearchCluster(1e5675defe924b14af39136bd476fe36), stat=4294980506,4294980506,1544207967588,1544207967588,0,0,0,0,1403,0,4294980506\n]"
...
"message": "Plan successfully constructed: [PlanSuccessful()]"