Retrieve filters KQL Query

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.

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

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?

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.

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.

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 ?

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