Creating cluster with the API

Hi,

When I create a new cluster using the API, passing the json below, I get 201 status that it's been accepted but in ECE the deployment crashes with the error 'Cannot read property 'plan' of null'.

 'kibana': {'cluster_name': 'py_kib',
            'plan': {'cluster_topology': [{'instance_configuration_id': 'kibana',
                                           'zone_count': 1}],
                     'kibana': {'version': '6.4.0'},
                     'transient': {},
                     'zone_count': 2}},
 'plan': {'cluster_topology': [{'instance_configuration_id': 'data.default',
                                'node_type': {'data': True,
                                              'ingest': True,
                                              'master': True,
                                              'ml': False},
                                'zone_count': 1},
                               {'instance_configuration_id': 'data.highstorage',
                                'node_type': {'data': True,
                                              'ingest': True,
                                              'master': True,
                                              'ml': False},
                                'zone_count': 1}],
          'elasticsearch': {'curation': {'from_instance_configuration_id': 'data.default',
                                         'to_instance_configuration_id': 'data.highstorage'},
                            'version': '6.4.0'},
          'tiebreaker_topology': {'memory_per_node': 1024}},
 'settings': {'curation': {'specs': []}}}
TypeError: Cannot read property 'plan' of null
    at t.value (http://10.117.142.216:12400/app.a61f89c1e4fc0148a088.js:1:1397553)
    at dn (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:35450)
    at Tn (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:47482)
    at Yn (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:57315)
    at Kn (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:57623)
    at fr (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:61005)
    at ur (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:60514)
    at sr (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:60340)
    at ir (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:59712)
    at Jn (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:59071)
    at Object.enqueueSetState (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:67:22728)
    at l.i.setState (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:59:784)
    at l.onStateChange (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:41:224820)
    at Object.notify (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:67:59059)
    at e.notifyNestedSubs (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:67:59571)
    at l.onStateChange (http://10.117.142.216:12400/vendor.9b5136f2335ece1032af.js:41:224838)

I'm also getting this error...

{'errors': [{'code': 'root.invalid_json_request',
             'fields': ['plan.elasticsearch'],
             'message': 'JSON request does not comply with schema: [Object is '
                        "missing required member 'elasticsearch']"}]}

when I omit elasticsearch from the plan, even though it isn't required according to the API reference at https://www.elastic.co/guide/en/cloud-enterprise/current/ElasticsearchClusterPlan.html so not sure if that should be required in the docs or I'm just misunderstanding something somewhere ( more likely :slight_smile: )

I'm on 2.0.0 if that makes a difference too.

Thanks
James

Hey @JamesNotJamez

There are a few issues here:

  1. The plan you are submitting is missing the size (TopologySize) field in the cluster topology elements.

Try this instead (adjusting the values as necessary):

{
	"kibana": {
		"cluster_name": "py_kib",
		"plan": {
			"cluster_topology": [
				{
					"instance_configuration_id": "kibana",
					"zone_count": 1,
					"size": {
						"value": 1024,
						"resource": "memory"
					}
				}
			],
			"kibana": {
				"version": "6.4.0"
			},
			"transient": {},
			"zone_count": 2
		}
	},
	"plan": {
		"cluster_topology": [
			{
				"instance_configuration_id": "data.default",
				"node_type": {
					"data": true,
					"ingest": true,
					"master": true,
					"ml": false
				},
				"zone_count": 1,
				"size": {
					"value": 1024,
					"resource": "memory"
				}
			},
			{
				"instance_configuration_id": "data.highstorage",
				"node_type": {
					"data": true,
					"ingest": true,
					"master": false,
					"ml": false
				},
				"zone_count": 1,
				"size": {
					"value": 1024,
					"resource": "memory"
				}
			}
		],
		"elasticsearch": {
			"curation": {
				"from_instance_configuration_id": "data.default",
				"to_instance_configuration_id": "data.highstorage"
			},
			"version": "6.4.0"
		},
		"tiebreaker_topology": {
			"memory_per_node": 1024
		}
	},
	"settings": {
		"curation": {
			"specs": []
		}
	}
}
  1. The API gladly accepts this plan, because it is "partially" a valid way to downscale (terminate) a deployment. The issue that you've run into is a bug that has surfaced due to this partially correct plan not being properly handled by the UI. I've filed an issue for our team to fix -- but applying the corrected plan above should avoid this altogether.

  2. plan.elasticsearch is definitely a required field (as the error indicates). This is simply a bug in our documentation -- which we'll also fix, so thank you for pointing that out!

Let me know if this helps.

Greg

Thanks Greg, that's got it working now :grin:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.