Create a first deployment: Just an Elasticsearch cluster

For our API exploration in some of the later examples, we need a basic deployment called My First Deployment that includes nothing but an Elasticsearch cluster. The deployment takes its name from the cluster name.

The following API call includes all the necessary JSON you need to create this basic deployment:

curl -k -X POST -u $USER:$PASSWORD https://$COORDINATOR_HOST:12443/api/v1/clusters/elasticsearch -H 'content-type: application/json' -d '{
  "cluster_name" : "My First Deployment",
  "plan" : {
      "elasticsearch" : {
          "version" : "6.5.4"
      },
      "cluster_topology" : [
          {
              "memory_per_node" : 2048,
              "node_count_per_zone" : 1,
              "node_type" : {
                 "data" : true,
                 "ingest" : true,
                 "master" : true,
                 "ml" : true
              },
              "zone_count" : 1
          }
      ]
  }
}'

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

If you look closely, you can see that we use the same /api/v1/clusters/elasticsearch endpoint as in our very first API example. The difference is that we now perform a POST request instead of a GET to create a deployment.

If your installation of ECE does not include Elasticsearch 6.6.0, you can create a cluster for any version that you do have available. You can also add the missing versions to your installation by adding new Elastic Stack packs.

After the API call completes, Elastic Cloud Enterprise returns some information that you’re going to need later on, such as the cluster ID and the password for the elastic superuser. Write this information down and keep it somewhere safe.

{
  "elasticsearch_cluster_id": "$ELASTICSEARCH_CLUSTER_ID",
  "credentials": {
    "username": "elastic",
    "password": "$PASSWORD"
  }
}