1.1.3 • Published 2 years ago
@onsmart/opensearch-migration-cli v1.1.3
Onsmart Elasticsearch Migration CLI
A CLI to perform elasticsearch migrations.
Installation
Use yarn or npm to install it.
yarn add @onsmart/elasticsearch-migration-cli --dev
npm i @onsmart/elasticsearch-migration-cli -DUsage
Create a
migrationsfolderRun
setupcommand
The setup command will create a new index in elasticsearch called onsmart-core-migrations-metadata to store the migrations were performed. You need to run it once.
> elasticsearch-migration-cli setup --elasticsearchCluster <cluster-url> --elasticsearchApiKey <api-key>You can change the default index name with the flag migrationMetadataAlias, for example:
> elasticsearch-migration-cli setup --elasticsearchCluster <cluster-url> --elasticsearchApiKey <api-key> --migrationMetadataAlias <index-name>- Create a migration file by running this command:
> elasticsearch-migration-cli create-migration- Basically, the elasticsearch migration CLI works with two commands:
upanddown. Both have the same flags:
--elasticsearchCluster <string>: The Elasticsearch Cluster URL--elasticsearchApiKey <string>: The Elasticsearch Api Key with permissions tomanageindexes--migration <string>: The migration name--appVersion <string>: The application version to group and persist the migrations--save: This option will persist a document inonsmart-core-migrations-metadata, this prevents the migration from running twice
- If you want to test locally, you can run this command below:
> elasticsearch-migration-cli up --elasticsearchCluster http://localhost:9200 --migration <migration-name>Deployment
To deploy this project, follow these steps:
- Click on "Actions Tab"
- Choose the "Onsmart Elasticsearch Migration CLI Deploy" option
- Click on "Run Workflow"
- Select "main" branch
- Run workflow
License
1.1.3
2 years ago