What is the node type for ml?

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
opensearch 2.7.0

Describe the issue:
According to these pages,
Creating a cluster - OpenSearch documentation
About ML Commons - OpenSearch documentation
node type for ml is dynamic or ml.
so I gave the type for each node like this


but neither didn’t set ml role in node.role(both nodes follow “dir” - data, ingest, remote~)
I want to configure a node with “ml” role.
how to set in docker-compose.yml?

@cucukaka I had a look at the node.role in the older version and it was used until version 2.0.0.

In version 2.1.0, the new field node.roles has been introduced to support dynamic and ml node roles.

You should refer to node.roles from version 2.1.0 and onwards.

Please find more details in the OpenSearch 2.1.0 release notes.

which one is the “ml” roles in node between “dynamic” and “ml”?

@cucukaka Sorry but I don’t get the question. Could you elaborate on that?

yeah I mean,
there is a “node.role” setting in docker-compose.yml when I configed opensearch cluster.
In “node.roles” , Which of the two values of ml and dynamic really serves as machine learning?
“ml” or “dymanic” or both? or does it matter what?

version: '3'
services:
  os-node:
    image: opensearchproject/opensearch:latest
    container_name: os-node
    environment:
      - cluster.name=os
      - node.name=os-node
      - node.roles="data", "ml", "dynamic"

@cucukaka The node type list in the OS documentation refers to the types of nodes and not the specific node role names.

According to this PR, new functionality has been introduced in OS 2.1, which is called dynamic roles.
What it means in practice is defining any role in the node.roles other than built-in (data, ingest, master, remote) will not fail the OpenSearch node startup process.

i.e.
Defining custom roles in roles.mapping

 node.roles=cluster_manager,role1,role2,custom_role

will result with this output of the _cat/nodes in OpenSearch 2.1+

but it will fail in the older version as it doesn’t support dynamic (custom) roles.

Regarding the Machine Learning role, as per the OS documentation, you should configure an ml role in the nodes.roles. Should, because it is not mandatory to have it configured.
The ml role makes the node a dedicated node for ML functions and tasks. The ML plugin will first look for the nodes with ml role to route the tasks to that node. If there are no ml nodes configured in the cluster, the ML plugin will use data nodes instead.