I am trying to query elasticsearch indices from client side of kibana plugin.
I was unable to find any native kibana plugin components which can readily enable me to create a client with which I can make request to elasticsearch with all the Privileges and roles of user.
Currently I resorted to making a fetch request like this
fetch ("/api/console/proxy?path=indexName%2F_search&method=GET", requestOptions)
in app.tsx or other child modules of app.tsx in
public/components folders of generated kibana plugin ( generated using plugin generator in scripts)
Which works fine in local development environment but, when deployed in prod gives me
404 for normal and works fine for superuser or admin users.
The whole setup is on version 7.9.1, For building the plugin we are using 7.x branch of kibana