I also use Shield in my cluster, and I am aware of that Kibana builds 2 connections toward the ES (one in the name of the technical user to access .kibana, and another for discover / console /... in the name of the authenticated user).
I would like to use these previously built connections (just like in Console or Discover) to propagate my requests in the name of the logged in user instead of the manually built one.
you can access preconfigured elasticsearch clients from the elasticsearch plugin. This is briefly described in the chapter Communicating with Elasticsearch of the Kibana documentation. Instead of the "ping" request shown in there you can use any method supported by elasticsearch-js.
this is something which I was also looking for, your help is much appreciated.
However the methods described in the Elasticsearch-js documentation have two input parameters: the query object and a function to handle errors and the response.
Promises are the preferred and supported way of composing asynchronous operations in Kibana. The callback style is not supported by callWithRequest. What particular disadvantage to you see with your use of .then() and .catch()?
You might want to try the async/await syntax which builds on Promises and is also widely used in Kibana:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.