Skip to content

Instantly share code, notes, and snippets.

@Wimpje
Created July 13, 2017 10:39
Show Gist options
  • Save Wimpje/08ad73be12b0fc4a3d5ec57f528923df to your computer and use it in GitHub Desktop.
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
$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