Both sides previous revisionPrevious revisionNext revision | Previous revision |
wiki:elasticsearch_commands [2022/12/09 09:45] – remove Troubleshooting antisa | wiki:elasticsearch_commands [2023/01/11 16:03] (current) – [Restore snapshot] add restore single index antisa |
---|
| |
curl -X PUT "localhost:9200/_snapshot/es_backup/ztest?wait_for_completion=true&pretty" | curl -X PUT "localhost:9200/_snapshot/es_backup/ztest?wait_for_completion=true&pretty" |
| |
| <WRAP center round tip 60%> |
| To create single index snapshot use |
| <code> |
| curl -X PUT "localhost:9200/_snapshot/default_backup/myindex_backup?wait_for_completion=true&pretty" -H 'Content-Type: application/json' -d' |
| { |
| "indices": "coolindex" |
| }' |
| </code> |
| </WRAP> |
| |
The backup folder is created in ///opt/backup/elasticsearch///. | The backup folder is created in ///opt/backup/elasticsearch///. |
| |
curl -s -X POST "localhost:9200/_snapshot/es_backup/snapshot-12/_restore" | curl -s -X POST "localhost:9200/_snapshot/es_backup/snapshot-12/_restore" |
| |
| <WRAP center round tip 60%> |
| To restore single index use |
| <code> |
| curl -s -X POST "localhost:9200/_snapshot/myes_bak/snapshot-2023-01-11/_restore" -H 'Content-Type: application/json' -d' |
| { |
| "indices": "niceindex" |
| }' |
| </code> |
| </WRAP> |
| |
If you get an [[https://github.com/elastic/elasticsearch/issues/78320|error]] that an index exist, like with the system index ''.geoip_databases'', you can restore the system indices from the snapshot as well with | If you get an [[https://github.com/elastic/elasticsearch/issues/78320|error]] that an index exist, like with the system index ''.geoip_databases'', you can restore the system indices from the snapshot as well with |
| |
curl -s -X POST "localhost:9200/_snapshot/es_backup/snapshot-12/_restore" -H 'Content-Type: application/json' -d | curl -s -X POST "localhost:9200/_snapshot/es_backup/snapshot-12/_restore" -H 'Content-Type: application/json' -d \ |
'{ | '{ |
"include_global_state": true | "include_global_state": true |
====== References ====== | ====== References ====== |
* https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshots-restore-snapshot.html | * https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshots-restore-snapshot.html |
| * https://opster.com/guides/elasticsearch/how-tos/elasticsearch-snapshot/ |
| |
| |