# Access elasticsearch query from Kibana Dashboard

**URL:** <https://discuss.elastic.co/t/access-elasticsearch-query-from-kibana-dashboard/204235>\
**Category:** Kibana\
**Created:** [October 18, 2019, 2:09pm UTC](https://discuss.elastic.co/t/access-elasticsearch-query-from-kibana-dashboard/204235 "2019-10-18T14:09:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [October 18, 2019, 2:09pm UTC](https://discuss.elastic.co/t/access-elasticsearch-query-from-kibana-dashboard/204235/1 "2019-10-18T14:09:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [October 22, 2019, 7:58pm UTC](https://discuss.elastic.co/t/access-elasticsearch-query-from-kibana-dashboard/204235/2 "2019-10-22T19:58:28Z")

</div>

Hello Tobias,

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

 ![15%20PM](https://us1.discourse-cdn.com/elastic/original/3X/2/7/274b4d2307282d6d612ce5534f87b620e2a62d7e.png)  
But this is for individual visualizations though.

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

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [October 29, 2019, 8:22am UTC](https://discuss.elastic.co/t/access-elasticsearch-query-from-kibana-dashboard/204235/3 "2019-10-29T08:22:22Z")

</div>

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 `props`you 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

---

<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 26, 2019, 8:22am UTC](https://discuss.elastic.co/t/access-elasticsearch-query-from-kibana-dashboard/204235/4 "2019-11-26T08:22:23Z")

</div>

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