Skip to content

Instantly share code, notes, and snippets.

@robertlyson
Last active June 26, 2017 09:05
Show Gist options
  • Save robertlyson/de4257f9eec49d2672960f2af51a27d9 to your computer and use it in GitHub Desktop.
Save robertlyson/de4257f9eec49d2672960f2af51a27d9 to your computer and use it in GitHub Desktop.
Elasticsearch failed shard recovery - powershellscript
# Based on http://www.jillesvangurp.com/2015/02/18/elasticsearch-failed-shard-recovery/
# Be carefull, you can lost your data during this process
$array = Get-ChildItem "ES_PATH\data\nodes\0" -recurse | Where-Object {$_.PSIsContainer -eq $true -and $_.Name -match "index"} | ForEach-Object -Process {$_.FullName}
foreach($element in $array)
{
Write-Output $element
$command = [string]::Format("java -cp ES_PATH\lib\lucene-core-6.3.0.jar -ea:org.apache.lucene... org.apache.lucene.index.CheckIndex {0} -exorcise",$element)
iex $command
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment