# Retrieve filters KQL Query

**URL:** <https://discuss.elastic.co/t/retrieve-filters-kql-query/317784>\
**Category:** Kibana\
**Created:** [October 31, 2022, 7:34am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784 "2022-10-31T07:34:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bandodkarD](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@bandodkarD](https://discuss.elastic.co/u/bandodkarD)\
**Post date:** [October 31, 2022, 7:34am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/1 "2022-10-31T07:34:50Z")

</div>

Can you advise how we can retrieve the backend KQL query once we filter out data on Kibana Dashboard?

Our requirement is to filter out data using charts and other visualisations are retrieve the query generated in backend. This query should contain the filters added on dashboard. Once we run the query on Dev tools it should give us all results.

 ![Screenshot 2022-10-31 at 12.55.39 PM](https://us1.discourse-cdn.com/elastic/original/3X/1/9/1920bf5c0859c982bc4beace1d5578c70d2d0692.png)

Is there a way to fetch the query part of it? We only need the query with saved and runtime filters.

---

<div class="post-metadata">

**Author:** ![JLeysens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jleysens/32/67404_2.png) [@JLeysens](https://discuss.elastic.co/u/JLeysens)\
**Post date:** [October 31, 2022, 10:17am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/2 "2022-10-31T10:17:14Z")

</div>

Hello @bandodkarD ! I am assuming you are already familiar with "Inspect" panel that displays the full JSON for the query that was run.

From what I understand, this should give you the information you need. I probably need to understand your use case better. Would you mind explaining more about it?

---

<div class="post-metadata">

**Author:** ![bandodkarD](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@bandodkarD](https://discuss.elastic.co/u/bandodkarD)\
**Post date:** [October 31, 2022, 10:45am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/3 "2022-10-31T10:45:24Z")

</div>

Hi @JLeysens,  
Yes we want a similar functionality like Inspect, but not the full Json only the query part with filters.

Basically we want an API to generate the backend ES query for a dashboard with filters applied.

The generated ES query will be used by the our platform user to get the results and perform actions/remediations on the data.

The query should include all the filters that are applied on the dashboard. This includes the saved filters as well as the temporary runtime filters.

This API will be consumed by the our UI when on click of a button the API would be called with input params like the dashboard ID, the selected filters json object, etc.

---

<div class="post-metadata">

**Author:** ![JLeysens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jleysens/32/67404_2.png) [@JLeysens](https://discuss.elastic.co/u/JLeysens)\
**Post date:** [October 31, 2022, 11:04am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/4 "2022-10-31T11:04:09Z")

</div>

I don't believe such an API exists. I'm not sure how you will capture temporary filters since they only exist in the user's browser at that point in time in Kibana - how will these be visible to your UI?

I'd suggest opening a feature request on the Kibana GitHub detailing what you need.

---

<div class="post-metadata">

**Author:** ![bandodkarD](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@bandodkarD](https://discuss.elastic.co/u/bandodkarD)\
**Post date:** [October 31, 2022, 11:28am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/5 "2022-10-31T11:28:13Z")

</div>

Not on others UI, but the users UI itself.  
The user should be able to somehow generate this query with filters he wants.

If not an API, is there any other way ?

---

<div class="post-metadata">

**Author:** ![bandodkarD](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@bandodkarD](https://discuss.elastic.co/u/bandodkarD)\
**Post date:** [October 31, 2022, 12:08pm UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/6 "2022-10-31T12:08:41Z")

</div>

Is there a way to retrieve that request that you get once you click Inspect?  
Is there a API call for inspect?

---

<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 27, 2022, 7:34am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/7 "2022-11-27T07:34:59Z")

</div>



---

<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:** [December 25, 2022, 4:34am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/8 "2022-12-25T04:34:20Z")

</div>



---

<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:** [January 22, 2023, 4:35am UTC](https://discuss.elastic.co/t/retrieve-filters-kql-query/317784/9 "2023-01-22T04:35:09Z")

</div>

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