Is possible to create multiple Stored Scripts in 1 single operation using the API?

I have more than 2.5K lines in StoredScripts in my old Cloud 5.6 cluster. I want to transfer them to my new Cloud 8.10.4 Cluster. For this, is there a way to automate the creation of these a little using the API?

I created the Scripts in the following way but I have more than 200 Scripts, do you think I should do it 1 by one? :frowning:

POST _scripts/ss_dashboard_1
{
  "script": {
    "lang": "mustache",
        "source": """{"aggregations":{"nivel":{"terms":{"field":"{{año}}{{mes}}.nivel.keyword"},"aggregations":{"tipo_cliente":{"terms":{"field":"{{año}}{{mes}}.tipo_cliente.keyword"}}}}}}""",
        "options": {
          "content_type": "application/json; charset=UTF-8"
  }
}
}

There has been a lot of changes between version 5.6 and 8.10 so I suspect you will need to test each script to verify it still works. I would therefore recommend migrating and testing them all before simply uploading them and assuming they will continue to work.

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