@onsmart/opensearch-migration-cli
v1.1.3
Published
![Logo](https://beakyn-ui.s3.amazonaws.com/OUT_PRIMARY_LOGO_POS_RGB_BLACK_PILL.svg?2)
Downloads
18
Keywords
Readme
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 -D
Usage
Create a
migrations
folderRun
setup
command
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:
up
anddown
. Both have the same flags:
--elasticsearchCluster <string>
: The Elasticsearch Cluster URL--elasticsearchApiKey <string>
: The Elasticsearch Api Key with permissions tomanage
indexes--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