# How to access custom elastic search plugin url in kibana custom plugin

**URL:** <https://discuss.elastic.co/t/how-to-access-custom-elastic-search-plugin-url-in-kibana-custom-plugin/149642>\
**Category:** Kibana\
**Created:** [September 24, 2018, 9:13am UTC](https://discuss.elastic.co/t/how-to-access-custom-elastic-search-plugin-url-in-kibana-custom-plugin/149642 "2018-09-24T09:13:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ritesh-kapoor](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@ritesh-kapoor](https://discuss.elastic.co/u/ritesh-kapoor)\
**Post date:** [September 24, 2018, 9:13am UTC](https://discuss.elastic.co/t/how-to-access-custom-elastic-search-plugin-url-in-kibana-custom-plugin/149642/1 "2018-09-24T09:13:37Z")

</div>

A new Elasticsearch plugin with endpoint e.g. /\_pql is installed. I'm developing a new kibana plugin, How to send a request to this url through kibana

I have tried:

init: function (server) {  
server.route({  
method: ['POST', 'GET'],  
path: '/api/\_pql',  
handler: async (request, reply) =\> {

```
      console.log(request);

     
     const { callWithRequest } = server.plugins.elasticsearch.getCluster('admin');
     

      return callWithRequest(request, '/_pql', {"quey:":"example'"})
      .then(function (resp) {
       reply(response);
      });
    }
  });
},

```

and I'm getting

server error [09:14:58.081] [warning][process] Error: called with an invalid endpoint: /\_pql  
at callAPI

---

<div class="post-metadata">

**Author:** ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)\
**Post date:** [September 25, 2018, 2:57am UTC](https://discuss.elastic.co/t/how-to-access-custom-elastic-search-plugin-url-in-kibana-custom-plugin/149642/2 "2018-09-25T02:57:24Z")

</div>

You will need to extend elasticsearch-js to be aware of the new endpoint. The "clusters" represented by "getCluster" can not be extended, so you will need to create a new cluster with your elasticsearch-js extension. You can see how we did this with monitoring here: [https://github.com/elastic/kibana/blob/master/x-pack/plugins/monitoring/server/es\_client/instantiate\_client.js](https://github.com/elastic/kibana/blob/master/x-pack/plugins/monitoring/server/es_client/instantiate_client.js)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 23, 2018, 2:57am UTC](https://discuss.elastic.co/t/how-to-access-custom-elastic-search-plugin-url-in-kibana-custom-plugin/149642/3 "2018-10-23T02:57:25Z")

</div>

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