Node stats response structure doesn't look parser friendly

Hello there,

I recently started to dive into the metrics and stats I can get from ElasticSearch API, and came across the /_nodes/stats endpoint from where I can get an extensive stats on all the nodes in my cluster. However, the response structure is not really clear to me

{
    "_nodes": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "cluster_name": "docker-cluster",
    "nodes": {
	"kbd": {...}
    }
}

So my question is: Why nodes key got a dictionary/hash of disctionaries/hashes, rather then the list/array of dictionaries/hashes? At the moment I am trying to unmarshall such response in Nim language and this particular response structure causes lots of issues as I believe kbd is a unique ID of the node in the cluster and therefore cannot be specified untill runtime of the Nim application. IMHO, it would have been better to have the response in the form

{
    "_nodes": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "cluster_name": "docker-cluster",
    "nodes": [
	{"node_id": "kbd"...}
    ]
}

Would love to understand the reasoning of why the resposne is done in the way it is done.

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