const adminCluster = server.plugins.elasticsearch.getCluster('admin');
const dataCluster = server.plugins.elasticsearch.getCluster('data');
//ping as the configured elasticsearch.user in kibana.yml
adminCluster.callWithInternalUser('ping');
//ping as the user specified in the current requests header
adminCluster.callWithRequest(req, 'ping');