Created
July 13, 2017 10:39
-
-
Save Wimpje/08ad73be12b0fc4a3d5ec57f528923df to your computer and use it in GitHub Desktop.
Removes Elastic search indices that don't have an alias (probably old or test indices) WARNING REMOVES WITHOUT CONFIRMATION
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
$i = (invoke-webrequest http://localhost:9200/_alias | ConvertFrom-Json); $i.psobject.properties.name | where { $i.$_.aliases.psobject.properties.name -eq $null } | % {Write-Host (invoke-webrequest -method DELETE -uri "http://localhost:9200/$_") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment