Skip to content

Inzerd/migrateElasticIndex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Purpose:
This script is designed to address the issue of modifying field mappings for an existing index in Elasticsearch.

Workflow
Repository Creation: The script generates an FS-type repository and saves the index to be migrated.

Snapshot Generation: Once the repository is created, a snapshot is taken and a new temporary index is created by restoring the previous index.

Original Index Deletion: If the procedure is successful, the original index is deleted.

New Index Creation: The new index is created.

Document Migration: The document migration process begins.

Detailed Explanation
The script utilizes the Elasticsearch REST API to perform the necessary operations.

The FS repository is created to store the index snapshot.

The snapshot is taken to capture the current state of the index before the mapping changes.

A temporary index is created from the snapshot to facilitate the mapping modifications.

Once the mapping is updated in the temporary index, the original index is safely deleted.

The new index is created with the updated mapping.

The script iterates over the documents in the temporary index and reindexes them into the new index with the revised mapping.

Important Notes
Ensure that you have the necessary permissions to access and modify Elasticsearch indices.

Back up your data before running this script as a precautionary measure.

Carefully review the mapping changes to avoid any potential data inconsistencies.

Usage
Save the script as a .ps1 file.

Modify the script parameters as needed, such as index names and repository settings.

Run the script using PowerShell with administrator privileges.

Monitor the script's execution to ensure successful completion.

By following these steps, you can effectively migrate documents from one index to another while updating the field mappings in the process.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors