If you enable the Elastic monitoring features in your cluster, there are two methods to collect metrics about Elasticsearch:
To learn about monitoring in general, see Monitoring the Elastic Stack.