Exporting data from a visualization

Hi,
I'm new to Kibana, and I need to export some data from a table visualization (pull it once in a while, with the current time), using python.
What I actually want, is basically a csv or a JSONI can turn to a pandas Dataframe or something similar, so I can work with it easily.
I'm using the "Inspect -> View: Requests -> Request" feature to get the query, and the JSON response is theoretically fine, but for some reason, using aggregations makes the output JSON awful. It does hold the needed information, but has really weird order, random field names such as "1", "7", that I don't seem to be able to change the name of, but do hold some of the data, some unnecessary details, repeating none indicative names ("buckets"), and other odd things.
All I need is exactly what I see in the table, with the correct names and the correct data. Is there any way to get that?
From what I found online, people seem to be converting whatever is in the "hits" field to csv, but when using aggregations this isn't relevant at all (at least in my case).

1 Like

Hi zivza,
Welcome to community!
You can copy that request from inspect -> View: Requests -> Request , Paste it into DevTools & you can customize those values and names as per your requirement.

1 Like

Thank you!
Is there any way I can get the data as a csv / get a JSON format that I can convert easily into a table?
Editing the query helps a lot, but it still seems fairly difficult to turn the output to the table I see on the visualization, since there's a lot of unneeded data.

Right now there's no such feature available.
You can track the progress on this issue where table-based visualization would provide some programmatic way to export CSVs.

Hi zivza! Have you looked into using SQL search using a Python client for ES? The response format is table-based. Here is some information about it: Getting Started with SQL | Elasticsearch Guide [8.11] | Elastic

1 Like

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