How to use the connection that kibana is using to Elasticsearch in kibana plugin?

Hi all,

I'm building a kibana plugin with a new connection such as below:

const elasticsearch = require('elasticsearch');
const client = new elasticsearch.Client({ host: ''});

const search = function search(index, body) {
return{index: index, body: body});

Now I want to use the connection that kibana is using Instead of creating new a new connection to elasticsearch from plugin.
Please tell me know how to do it? thank you for any response.

Kibana connects to elasticsearch at <>:9200 which is the default and defined in Kibana.yml.

So you should be fine with your plugin?


Hi bhavyarm,

currently my plugin connect to Elasticsearch by opening a new connection, I want to know how I can reused the connection kibana is using?

There is an admin client which is used for managing Kibana's state, and a data client for all other requests!

Do you have a sample source code that a plugin reuses elasticsearch connection that kibana is using?

so far, I understood how elasticsearch work. We don't need to implement any connectionpool for ES, it already created a connectionpool for per nodes, normally ES there are 13 connections per node, maximun 14(one that is used for node discovery/sniffing/sampling.)

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