Use Kibana current user to send request to Elasticsearch plugin

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?

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

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

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