Is there any way to create the OpenSearchDashbaord Programmatically using Python Client

Hi Team,

Could you please help me on this…

is there any way to create the OpenSearch dashboard Programmatically using Python Client…

Thanks In Advance…

Thanks,
Hema

Not sure about OpenSearch, but in Kibana (tried in version 6.x) you could export a dashboard as a json and them there was a REST endpoint to import a dashboard via a JSON. I used that to dynamically create a dashboard in a jenkins pipeline sometime back. OpenSearch dashboard should have the same API.

ThankYou Imesha… Yes but i too didn’t found the OpenSearchDashboard API’s to create the Dashboard programetically… seems we need to use Kibana endpoint to do the same…

Indeed, I’ve been using the following:

To export json object (dashboard/viz/…):

curl -u 'user:pass' -X POST 'http://localhost:5601/api/saved_objects/_export' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -H 'securitytenant: test_tenant' -d '{
  "objects": [
    {
      "type": "dashboard",
      "id": "a12ccca0-g567-15eb-9v71-c92d207nv042"
    }
  ],
  "includeReferencesDeep": true
}' > export.ndjson

To import json object (dashboard/viz/…):

curl -u 'user:pass' -X POST 'http://localhost:5601/api/saved_objects/_import?overwrite=true' -H 'securitytenant: test_tenant' -H 'kbn-xsrf: true' --form file=@export.ndjson