How to create Elasticsearch dashboard using dev tool\console?

I want to create elastic dashboard with python code.
can I use dev tool\console for this purpose? if not, what is the alternative way?
How can I download the Json file of my current dashboard?

Hi @maziar,

Welcome to the Elastic community.

You can use import and export dashboard api. What you can do is

  1. Create a dashboard and save as a object.
  2. Export dashboard object and check what things you can make dynamic.
  3. Once you done you import the object according to your requirement.

This is purely REST API, So you can hit using python.

thank you @ashishtiwari1993,
for one dashboard I can import/export with API, but when I query all existing dashboards with

curl -X GET 'https://127.0.0.1:5656/api/saved_objects/_find?type=dashboard

it shows that I have 30 dashboards, but the list only contains 20 dashboards. that 20 dashboards are also randomly from page one and two, and it is not like it is returning only dashboards from page one.

[
    {
        "page": 1,
        "per_page": 20,
        "total": 30,
        "saved_objects": [
            {dashbords 1 to 20} 
     ]
}

I only have one space. Do you know what I am missing here to store all dashboards?

for others if they face the same issue, I was able to solve the problem to export all dashboards by increasing the page numbers

        page = 1
        per_page = 20
        dashboards_json = []

        while True:
            url = f'{ELASTIC_URL}/api/saved_objects/_find?type=dashboard&page={page}&per_page={per_page}'
            headers = {
                'kbn-xsrf': 'true',
                'Content-Type': 'application/json',
                'Authorization': self.secrets['ELASTIC_SECRET']
            }

            response = requests.request("GET", url, headers=headers)
            dashboards_json = dashboards_json + response.json()["saved_objects"]

            # If this is the last page, break the loop
            if page * per_page >= response.json()['total']:
                break
            # Otherwise, move to the next page
            page += 1