@@ -21,7 +21,7 @@ Install [pre-commit](https://pre-commit.com/#install).
21
21
Prior to commit, run:
22
22
23
23
``` shell
24
- pre-commit run --all-files`
24
+ pre-commit run --all-files
25
25
```
26
26
27
27
@@ -81,7 +81,7 @@ Create a snapshot repository. This puts the files in the `elasticsearch/snapshot
81
81
the elasticsearch.yml and docker-compose files create a mapping from that directory to
82
82
` /usr/share/elasticsearch/snapshots ` within the Elasticsearch container and grant permissions on using it.
83
83
84
- ```
84
+ ``` shell
85
85
curl -X " PUT" " http://localhost:9200/_snapshot/my_fs_backup" \
86
86
-H ' Content-Type: application/json; charset=utf-8' \
87
87
-d $' {
@@ -97,7 +97,7 @@ a snapshot named `my_snapshot_2` and waits for the action to be completed before
97
97
asynchronously, and queried for status. The ` indices ` parameter determines which indices are snapshotted, and
98
98
can include wildcards.
99
99
100
- ```
100
+ ``` shell
101
101
curl -X " PUT" " http://localhost:9200/_snapshot/my_fs_backup/my_snapshot_2?wait_for_completion=true" \
102
102
-H ' Content-Type: application/json; charset=utf-8' \
103
103
-d $' {
@@ -113,20 +113,20 @@ curl -X "PUT" "http://localhost:9200/_snapshot/my_fs_backup/my_snapshot_2?wait_f
113
113
114
114
To see the status of this snapshot:
115
115
116
- ```
116
+ ``` shell
117
117
curl http://localhost:9200/_snapshot/my_fs_backup/my_snapshot_2
118
118
```
119
119
120
120
To see all the snapshots:
121
121
122
- ```
122
+ ``` shell
123
123
curl http://localhost:9200/_snapshot/my_fs_backup/_all
124
124
```
125
125
126
126
To restore a snapshot, run something similar to the following. This specific command will restore any indices that
127
127
match ` items_* ` and rename them so that the new index name will be suffixed with ` -copy ` .
128
128
129
- ```
129
+ ``` shell
130
130
curl -X " POST" " http://localhost:9200/_snapshot/my_fs_backup/my_snapshot_2/_restore?wait_for_completion=true" \
131
131
-H ' Content-Type: application/json; charset=utf-8' \
132
132
-d $' {
@@ -137,15 +137,14 @@ curl -X "POST" "http://localhost:9200/_snapshot/my_fs_backup/my_snapshot_2/_rest
137
137
"indices": "items_*",
138
138
"rename_pattern": "items_(.+)"
139
139
}'
140
-
141
140
```
142
141
143
142
Now the item documents have been restored in to the new index (e.g., ` my-collection-copy ` ), but the value of the
144
143
` collection ` field in those documents is still the original value of ` my-collection ` . To update these to match the
145
144
new collection name, run the following Elasticsearch Update By Query command, substituting the old collection name
146
145
into the term filter and the new collection name into the script parameter:
147
146
148
- ```
147
+ ``` shell
149
148
curl -X " POST" " http://localhost:9200/items_my-collection-copy/_update_by_query" \
150
149
-H ' Content-Type: application/json; charset=utf-8' \
151
150
-d $' {
@@ -164,7 +163,7 @@ curl -X "POST" "http://localhost:9200/items_my-collection-copy/_update_by_query"
164
163
165
164
Then, create a new collection through the api with the new name for each of the restored indices:
166
165
167
- ```
166
+ ``` shell
168
167
curl -X " POST" " http://localhost:8080/collections" \
169
168
-H ' Content-Type: application/json' \
170
169
-d $' {
0 commit comments