Setting up machine learning
Elastic Stack Serverless
To use the Elastic Stack machine learning features, you must have:
the appropriate subscription level or the free trial period activated
xpack.ml.enabled
set to its default value oftrue
on every node in the cluster (refer to Machine learning settings in Elasticsearch)ml
value defined in the list ofnode.roles
on the machine learning nodesmachine learning features visible in the Kibana space
security privileges assigned to the user that:
- grant use of machine learning features, and
- grant access to source and destination indices.
Assigning security privileges affects how users access machine learning features. Consider the two main categories:
- Elasticsearch API user: uses an Elasticsearch client, cURL, or Kibana Dev Tools to access machine learning features via Elasticsearch APIs. It requires Elasticsearch security privileges.
- Kibana user: uses the machine learning features in Kibana and does not use Dev Tools. It requires either Kibana feature privileges or Elasticsearch security privileges and is granted the most permissive combination of both. Kibana feature privileges are recommended if you control job level visibility via Spaces. Machine learning features must be visible in the relevant space. Refer to Feature visibility in Spaces for configuration information.
You can configure these privileges
- under Security. To open Security, find Stack Management in the main menu or use the global search field.
- via the respective Elasticsearch security APIs.
If you use machine learning APIs, you must have the following cluster and index privileges:
For full access:
machine_learning_admin
built-in role or the equivalent cluster privilegesread
andview_index_metadata
on source indicesread
,manage
, andindex
on destination indices (for data frame analytics analytics jobs only)
For read-only access:
machine_learning_user
built-in role or the equivalent cluster privilegesread
index privileges on source indicesread
index privileges on destination indices (for data frame analytics analytics jobs only)
In Kibana, the machine learning features must be visible in your space. To manage which features are visible in your space, go to Stack Management > Kibana > Spaces or use the global search field to locate Spaces directly.

In addition to index privileges, source data views must also exist in the same space as your machine learning jobs. You can configure these under Data Views. To open Data Views, find Stack Management > Kibana in the main menu, or use the global search field.
Each machine learning job and trained model can be assigned to all, one, or multiple spaces. This can be configured in Machine Learning. To open Machine Learning, find Stack Management > Alerts and Insights in the main menu, or use the global search field. You can edit the spaces that a job or model is assigned to by clicking the icons in the Spaces column.

Within a Kibana space, for full access to the machine learning features, you must have:
Machine Learning: All
Kibana privilegesData Views Management: All
Kibana feature privilegesread
, andview_index_metadata
index privileges on your source indices- data views for your source indices
- data views,
read
,manage
, andindex
index privileges on destination indices (for data frame analytics analytics jobs only)
Within a Kibana space, for read-only access to the machine learning features, you must have:
Machine Learning: Read
Kibana privileges- data views for your source indices
read
index privilege on your source indices- data views and
read
index privileges on destination indices (for data frame analytics analytics jobs only)
For access to use machine learning APIs via Dev Tools in Kibana, set the Elasticsearch security privileges and grant access to machine_learning_admin
or machine_learning_user
built-in roles.
Within a Kibana space, to upload and import files in the Data Visualizer, you must have:
Machine Learning: Read
orDiscover: All
Kibana feature privilegesData Views Management: All
Kibana feature privilegesingest_admin
built-in role, ormanage_ingest_pipelines
cluster privilegecreate
,create_index
,manage
andread
index privileges for destination indices
For more information, see Security privileges and Kibana privileges.