# Use Kibana current user to send request to Elasticsearch plugin

**URL:** https://discuss.elastic.co/t/use-kibana-current-user-to-send-request-to-elasticsearch-plugin/286732
**Category:** Kibana
**Created:** [October 14, 2021, 1:52pm UTC](https://discuss.elastic.co/t/use-kibana-current-user-to-send-request-to-elasticsearch-plugin/286732 "2021-10-14T13:52:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![aza-zil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aza-zil/32/92217_2.png) [@aza-zil](https://discuss.elastic.co/u/aza-zil)
#### Post date: [October 14, 2021, 1:52pm UTC](https://discuss.elastic.co/t/use-kibana-current-user-to-send-request-to-elasticsearch-plugin/286732/1 "2021-10-14T13:52:42Z")

</div>

I have an ES ActionPlugin that has an API, and I created a Kibana plugin, I want the Kibana plugin to send a post request to the ES plugin using  
context.core.Elasticsearch.legacy.client.callAsInternalUser  
or  
context.core.elasticsearchclient.asInternalUser  
How can I do that?

---

<div class="post-metadata">

### Author: ![poff](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/poff/32/81795_2.png) [@poff](https://discuss.elastic.co/u/poff)
#### Post date: [October 14, 2021, 8:35pm UTC](https://discuss.elastic.co/t/use-kibana-current-user-to-send-request-to-elasticsearch-plugin/286732/2 "2021-10-14T20:35:17Z")

</div>

Hey there! If you've created a Kibana plugin, on the server side, you should have access to `core.elasticsearch.client` where ever you have access to the core plugin setup. Additionally if you setup a router on the server side of things, you will have access via the context argument when defining your route handler [kibana/server\_search\_route.ts at master · elastic/kibana · GitHub](https://github.com/elastic/kibana/blob/master/examples/search_examples/server/routes/server_search_route.ts#L27)

---

<div class="post-metadata">

### Author: ![aza-zil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aza-zil/32/92217_2.png) [@aza-zil](https://discuss.elastic.co/u/aza-zil)
#### Post date: [October 15, 2021, 1:37am UTC](https://discuss.elastic.co/t/use-kibana-current-user-to-send-request-to-elasticsearch-plugin/286732/3 "2021-10-15T01:37:39Z")

</div>

Thanks @poff,  
How can I do the same thing in java with "nodeClient"?

---

<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: [November 12, 2021, 1:38am UTC](https://discuss.elastic.co/t/use-kibana-current-user-to-send-request-to-elasticsearch-plugin/286732/4 "2021-11-12T01:38:00Z")

</div>

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