[[get-desired-nodes]]
=== Get desired nodes API
++++
<titleabbrev>Get desired nodes</titleabbrev>
++++

NOTE: {cloud-only}

.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-cluster[Cluster APIs].
--

Get desired nodes.

[[get-desired-nodes-request]]
==== {api-request-title}

//////////////////////////
[source,console]
--------------------------------------------------
PUT /_internal/desired_nodes/my_history/1
{
    "nodes" : [
        {
            "settings" : {
                 "node.name" : "instance-000187",
                 "node.external_id": "instance-000187",
                 "node.roles" : ["data_hot", "master"],
                 "node.attr.data" : "hot",
                 "node.attr.logical_availability_zone" : "zone-0"
            },
            "processors" : 8.0,
            "memory" : "59gb",
            "storage" : "2tb"
        }
    ]
}
--------------------------------------------------
// TESTSETUP


[source,console]
--------------------------------------------------
DELETE /_internal/desired_nodes
--------------------------------------------------
// TEST
// TEARDOWN

//////////////////////////

[source,console]
--------------------------------------------------
GET /_internal/desired_nodes/_latest
--------------------------------------------------
// TEST

[[get-desired-nodes-desc]]
==== {api-description-title}

This API gets the latest desired nodes.

[[get-desired-nodes-examples]]
==== {api-examples-title}

This example gets the latest desired nodes.

[source,console]
--------------------------------------------------
GET /_internal/desired_nodes/_latest
--------------------------------------------------
// TEST

The API returns the following result:

[source,console-result]
--------------------------------------------------
{
    "history_id": <history_id>,
    "version": <version>,
    "nodes": [
        {
            "settings": <node_settings>,
            "processors": <node_processors>,
            "memory": "<node_memory>",
            "storage": "<node_storage>"
        }
    ]
}
--------------------------------------------------
// TEST[s/<history_id>/$body.history_id/]
// TEST[s/<version>/$body.version/]
// TEST[s/<node_settings>/$body.nodes.0.settings/]
// TEST[s/<node_processors>/$body.nodes.0.processors/]
// TEST[s/<node_memory>/$body.nodes.0.memory/]
// TEST[s/<node_storage>/$body.nodes.0.storage/]
// TEST[s/<node_version>/$body.nodes.0.node_version/]
