'Create Index Pattern' via python3 / API

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

OpenSearch Dashboards v2.5.0

Describe the issue:

Using python3 and the API, have successfully ingested data, created an index and bulk loaded the data.

I have a dashboard that I manually set up by going to Stack Management → Index Patterns → Create Index Pattern; and creating an index pattern with the data I uploaded; then I can make dashboards / visualizations.

Is there a way via the API to do this part “Stack Management → Index Patterns → Create Index Pattern”?

My hope is that since I have a manual dashboard, when I upload new data to the same index, if I can re-create or update the index pattern, the dashboard will just update to reflect the new data that has been added.

Not certain if this is possible; appreciate any ideas.

Thanks!

Dan.

Configuration:

Relevant Logs or Screenshots:

You can call the saved object API of OpenSearch-Dashboards, note the request url should be OSD’s endpoint, not OpenSearch’s, like this:

$ curl -X POST localhost:5601/api/index_patterns/index-pattern/my-pattern  -H 'osd-xsrf: true' -H 'Content-Type: application/json' -d '
{
  "attributes": {
    "title": "my-pattern-*"
  }
}'