Access elasticsearch query from Kibana Dashboard

I have created a plugin created for Kibana 7.3.3 and want to access the elasticsearch query that I need in order to get the same set of data that is shown in my dashboard, including the time range.

I found in the documentation the VIS object, mentioning the queryFilter located at vis.API.queryFilter but it just returns "{}". Is there a different object I need to access, or do I have to fully reconstruct the ES query from the URL?

Hello Tobias,

Have you tried to look at inspector to see if you can access the query?

But this is for individual visualizations though.

cc @timroes how do we access the whole query to a dashboard?


I finally managed to find it. It took a lot of digging, so to save some time for anyone needing it in the future, I post here an answer.

I used a React.Component to create my visualization. From the propsyou can access the filters used in your dashboard:

  • time range: props.vis.API.timeFilter.getTime() - Gives an object which has from and to
  • filters: props.vis.API.queryFilter.getFilters() - Gives an array of all currently applied filters

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