with one click
opensearch-flux
// Guides users through migrating OpenSearch Dashboards saved objects (dashboards, visualizations, index patterns) between instances using the osd-migrate CLI tool.
// Guides users through migrating OpenSearch Dashboards saved objects (dashboards, visualizations, index patterns) between instances using the osd-migrate CLI tool.
| name | opensearch-flux |
| description | Guides users through migrating OpenSearch Dashboards saved objects (dashboards, visualizations, index patterns) between instances using the osd-migrate CLI tool. |
| version | 1.0.0 |
| tags | ["opensearch","migration","dashboards"] |
This skill helps users migrate saved objects between OpenSearch Dashboards instances. It drives the osd-migrate CLI tool through a multi-step workflow: export from source, inspect, and import to target with data source remapping, index pattern validation, and workspace management.
Before starting, verify:
node --versioncd src && npm installThe tool supports four auth types: iam, basic, cookie, and none.
For instances behind SAML or Cognito authentication, use cookie auth. The user just needs to copy the cookie value from their browser:
security_authentication--auth cookie --cookie <pasted_value>, for example:
npx tsx src/cli.ts export --source <endpoint> --auth cookie --cookie <pasted_value>
The tool auto-prefixes security_authentication= if the user pastes just the raw value, so they don't need to construct the full cookie string themselves.
Note: This is a session cookie — it expires when the browser session ends. If the migration takes a while, the user may need to grab a fresh cookie.
Run the export command to list dashboards, then export the chosen one:
cd src
# List dashboards (user picks one)
npx tsx src/cli.ts export --source <endpoint> --auth iam
# Export with all dependencies
npx tsx src/cli.ts export --source <endpoint> --auth iam --dashboard <id>
The export creates ./migration/export.ndjson and ./migration/inspection-report.json.
Review the inspection report for errors (missing references, broken dependencies).
Before importing, the agent MUST verify that the target has a suitable data source. This is critical — importing without a valid data source means objects can't query data.
When the source is AOS, the export won't contain data source references. The agent must:
--data-source-id or use list_data_sourcesWhen the source export contains data source references:
IMPORTANT: Never auto-proceed with a data source without user confirmation. The user must understand which data source their migrated objects will query.
# Discovery mode — lists source and target data sources
npx tsx src/cli.ts import \
--target <endpoint> --auth iam \
--file ./migration/export.ndjson \
--json
This returns JSON with:
sourceDataSources: data sources referenced in the export (with titles and endpoints)targetDataSources: available data sources on the targetHelp the user match source to target data sources based on titles and endpoints.
Once the user has chosen a target data source, run the full import. Use --source <endpoint> to pass the original source endpoint — this enables the tool to validate index patterns against the source cluster during import:
npx tsx src/cli.ts import \
--source <source-endpoint> \
--target <endpoint> --auth iam \
--file ./migration/export.ndjson \
--data-source-id <target-ds-id> \
--target-workspace new \
--workspace-name "<name>" \
--workspace-type <analytics|essentials|observability|security-analytics|search> \
--create-new-copies \
--yes --json
If index patterns don't match between source and target, add remapping:
--remap-index-pattern "source-pattern*=target-pattern*"
After import, check the results:
successCount and errors<target-endpoint>/w/<workspaceId>/app/dashboardsOpenSearch UI stores objects with compound IDs: {dataSourceId}_{objectId}. The tool strips these automatically during import. No action needed from the agent.
The --data-source-id flag is required. It remaps all data source references in the exported objects to point to the target data source. Without it, imported objects can't query data.
When source and target use different index naming schemes, the tool:
If index patterns have NO matching indices on the target, the agent should STOP and warn the user before proceeding. The options are:
--remap-index-pattern "old-pattern*=new-pattern*"Do NOT silently continue when all index patterns fail validation — this means the migration will produce a non-functional dashboard.
analytics — general purpose (default)essentials — essential featuresobservability — logs, metrics, tracessecurity-analytics — security event analysissearch — search applicationsThe dashboard's searchSourceJSON may contain a dataset block with cached index pattern references from the source. The tool strips this automatically during import. If the dashboard shows empty visualizations, this is likely the cause — the stale dataset overrides the visualizations' own data source context.
When the target index doesn't have a field used in a visualization's filter (e.g., is_aws_internal), the filter causes the visualization to return 0 results on the dashboard. The tool auto-disables such filters during import. Inform the user which filters were disabled so they can review.
| Error | Cause | Fix |
|---|---|---|
| HTTP 403 on connect | Wrong signing service or missing permissions | Check --service flag and IAM permissions |
unsupported_type on import | Compound IDs not stripped | This shouldn't happen — the tool strips them automatically. If it does, check the NDJSON format |
data_source_required | No --data-source-id provided | Run discovery mode first, then re-run with the flag |
| Missing index patterns | Source/target use different index names | Use --remap-index-pattern to map old names to new |
| Missing fields | Target index has different schema | Inform user which visualizations will show "No data" |
| Visualizations show 0/empty on dashboard | Filters reference fields missing from target | Tool auto-disables these; re-import with --overwrite |
| Dashboard shows empty panels | Stale dataset block in dashboard searchSourceJSON | Tool strips this automatically; re-import with --overwrite |
| Embedded data source IDs not remapped | Data source IDs inside nested JSON strings | Tool handles deep remapping automatically |
osd-migrate export --source <url> --auth iam [--dashboard <id>] [--out <dir>]
[--source-workspace <id>]
[--cookie <value>] [--service <service>]
osd-migrate inspect --file <path>
osd-migrate import --target <url> --auth iam --file <path>
[--source <url>]
[--data-source-id <id>]
[--target-workspace <id|new>]
[--workspace-name <name>] [--workspace-type <type>]
[--remap-index-pattern "old=new"]
[--create-new-copies] [--overwrite]
[--cookie <value>] [--service <service>]
[-y|--yes] [--json]