wiki:elasticsearch_commands
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
wiki:elasticsearch_commands [2022/09/30 12:18] – created antisa | wiki:elasticsearch_commands [2023/01/11 16:03] (current) – [Restore snapshot] add restore single index antisa | ||
---|---|---|---|
Line 12: | Line 12: | ||
Replace " | Replace " | ||
- | ====== | + | ==== Delete all indices |
- | * | + | |
+ | curl -X DELETE ' | ||
+ | ===== Create snapshot ===== | ||
+ | Register repo first: | ||
+ | < | ||
+ | curl -X PUT -u undefined: | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | Instead of creating new repo, you can use the default_backup repo if you want. | ||
+ | |||
+ | Create first backup | ||
+ | |||
+ | curl -X PUT " | ||
+ | |||
+ | <WRAP center round tip 60%> | ||
+ | To create single index snapshot use | ||
+ | < | ||
+ | curl -X PUT " | ||
+ | { | ||
+ | " | ||
+ | }' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | The backup folder is created in /// | ||
+ | |||
+ | You can now zip this and transfer to another server. | ||
+ | |||
+ | ===== List snapshots ===== | ||
+ | |||
+ | curl -s -X GET " | ||
+ | curl -s -X GET " | ||
+ | |||
+ | ===== Restore snapshot ===== | ||
+ | If you have an archive, unarchive it to /// | ||
+ | |||
+ | tar xvf / | ||
+ | |||
+ | When you transfer it to another server unzip it, make sure that the owner is elasticsearch | ||
+ | |||
+ | List the snapshots with above command. | ||
+ | |||
+ | After this do the restore with snapshot name you want: | ||
+ | |||
+ | curl -s -X POST " | ||
+ | |||
+ | <WRAP center round tip 60%> | ||
+ | To restore single index use | ||
+ | < | ||
+ | curl -s -X POST " | ||
+ | { | ||
+ | " | ||
+ | }' | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | If you get an [[https:// | ||
+ | |||
+ | curl -s -X POST " | ||
+ | '{ | ||
+ | " | ||
+ | }' | ||
+ | |||
+ | ==== Tested on ==== | ||
+ | * ES 7.17.5 | ||
====== See also ====== | ====== See also ====== | ||
* [[wiki: | * [[wiki: | ||
+ | |||
====== References ====== | ====== References ====== | ||
+ | * https:// | ||
+ | * https:// | ||
wiki/elasticsearch_commands.1664540295.txt.gz · Last modified: 2022/09/30 12:18 by antisa