Created
August 20, 2024 13:25
-
-
Save HakanL/63f0874c8168ec372142a14c38f8a77d to your computer and use it in GitHub Desktop.
Shrink an ElasticSearch Index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT /XXXXX/_settings | |
{ | |
"settings": { | |
"index.blocks.write": true | |
} | |
} | |
POST /XXXXX/_split/XXXXX_split | |
{ | |
"settings": { | |
"index.number_of_shards": 2, | |
"index.number_of_replicas": 0 | |
} | |
} | |
POST /XXXXX_split/_shrink/XXXXX_shrunk | |
{ | |
"settings": { | |
"index.number_of_shards": 1, | |
"index.number_of_replicas": 0, | |
"index.codec": "best_compression" | |
} | |
} | |
POST /XXXXX_shrunk/_forcemerge | |
DELETE /XXXXX | |
DELETE /XXXXX_split | |
POST /_reindex | |
{ | |
"source": { | |
"index": "XXXXX_shrunk" | |
}, | |
"dest": { | |
"index": "XXXXX" | |
} | |
} | |
PUT /XXXXX/_settings | |
{ | |
"settings": { | |
"index.number_of_replicas": 0 | |
} | |
} | |
DELETE /XXXXX_shrunk | |
PUT /XXXXX/_settings | |
{ | |
"settings": { | |
"index.routing.allocation.require._name": null, | |
"index.blocks.write": null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment