Cannot read elasticsearch.hosts from kibana configuration

Hi all,

We were trying to read the elasticsearch cluster hosts in out plugin's server-side, but we were unable to find anything in the context parameter in callback function.

as shown in below code:

export function defineRoutes(router: IRouter, client: IScopedClusterClient, config: HttpServerInfo) {
      path: '/endpoint',
      validate: false,
    async (context, request, response) => {
      const requestOptions = {
        method: 'GET',
        headers: { 'Content-Type': 'application/json', 'Cluster': process.env["cluster"],  'Authorization': request.headers.authorization },
        agent: httpsAgent
      const info = await
      return fetch(serverURL + '/endpoint/', requestOptions)
        .then(response => {
'Enpoint: Endpoint success');

          if (response.status == 200) {
            return response.json()
          } else {
            throw new Error(response)
        }).then(res => {
          return response.ok({
            body: {
              Response: res
        .catch(async (err) => {
'EndPoint : ' + err);
          let message_ = await err.text().then(mm => {
            return mm;
          var resp_ = response.custom({
            body: {
              message: message_
            statusCode: err.status
          return resp_;

Neither I was able to find in const cluster = await config.hostname with the HttpServerInfo.

Please suggest any alternatives to retrieve the desired information.

Thanks and regards

Hello @K_Chaitanya

Which version of the Elastic stack are you using? Why do you want access to elasticsearch.hosts? Are you looking to make an Elasticsearch query?


Hi @mattkime ,

Thank you for your reply.

We running our ELK stack on version: 7.10.1

We have a decoupled architecture with Django in place with our Kibana plugin, so there is a scenario where a single Django API instance will communicate with different Elasticsearch deployments (we running on ECK).

So as to make python API aware of the Elasticsearch instance with which it needs to talk, we need to pass the hosts' information to python API.


I'm not sure how Django is communicating with your kibana plugin but I'd encourage you to use the query functionality available via the Kibana APIs rather than having Django make requests.

I'm checking to see if elasticsearch.hosts is exposed and will report back.

Update - Its not exposed.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.