# Accessing Query Object within my code

**URL:** <https://discuss.elastic.co/t/accessing-query-object-within-my-code/246296>\
**Category:** Kibana\
**Created:** [August 25, 2020, 1:44pm UTC](https://discuss.elastic.co/t/accessing-query-object-within-my-code/246296 "2020-08-25T13:44:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Gege](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_gege/32/45595_2.png) [@Paul\_Gege](https://discuss.elastic.co/u/Paul_Gege)\
**Post date:** [August 25, 2020, 1:44pm UTC](https://discuss.elastic.co/t/accessing-query-object-within-my-code/246296/1 "2020-08-25T13:44:12Z")

</div>

Hi all,

I'm just wondering if there's a way for me to grab the current query that's been run on a dashboard or visualization, and use it within a plugin that i'm developing.

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [August 25, 2020, 6:05pm UTC](https://discuss.elastic.co/t/accessing-query-object-within-my-code/246296/2 "2020-08-25T18:05:38Z")

</div>

Hello @Paul_Gege,

Its certainly possible but the answer may depend upon the type of plugin you're developing. What are you building and which version of the elastic stack are you targeting?

---

<div class="post-metadata">

**Author:** ![Paul\_Gege](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_gege/32/45595_2.png) [@Paul\_Gege](https://discuss.elastic.co/u/Paul_Gege)\
**Post date:** [August 25, 2020, 6:43pm UTC](https://discuss.elastic.co/t/accessing-query-object-within-my-code/246296/3 "2020-08-25T18:43:08Z")

</div>

I'm developing a plugin that allows the user to save the query on a dashboard visualization, this query can then be used to run an elasticsearch query in order to get the data and convert it to csv format. I'm using Kibana 7.7.0 as well.

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [August 26, 2020, 11:42am UTC](https://discuss.elastic.co/t/accessing-query-object-within-my-code/246296/4 "2020-08-26T11:42:56Z")

</div>

This pr provides a good interface but won't be available until 7.10. Still, it might show you how you might solve the problem yourself. [https://github.com/elastic/kibana/pull/72093](https://github.com/elastic/kibana/pull/72093)

---

<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:** [September 23, 2020, 11:42am UTC](https://discuss.elastic.co/t/accessing-query-object-within-my-code/246296/5 "2020-09-23T11:42:59Z")

</div>

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