How can i nest aggregation inside my Kibana plugin?

I want to aggregate data range from now to now-90 days then now to now-1hr and take average of that value. I can write a query in console to get values. But how to implement same inside my custom Kibana plugin?
Is JSON input a way to do that?
How can i run elastic search query from my kibana Plugin?
P.S. New to Kibana

I can write a query in console to get values.

How can i run Elasticsearch query from my kibana Plugin?

If you already have this query, you could just run it directly using the Elasticsearch client plugin, which Kibana makes available. You simply need to add elasticsearch as a dependency in your plugin. It will give you a configured client instance and then you have access to the entire elasticsearch.js client API.

Thanks

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