Skip to content

Instantly share code, notes, and snippets.

@wireframe
Created April 12, 2011 21:55
Show Gist options
  • Save wireframe/916516 to your computer and use it in GitHub Desktop.
Save wireframe/916516 to your computer and use it in GitHub Desktop.
#!/bin/bash
# error in log output
# [2011-04-12 17:07:03,319][DEBUG][action.admin.indices.status] [Foster, Tom] [foo][2], node[-Dbau_mxSR2TtFDAsvncyQ], [P], s[INITIALIZING]: Failed to execute [org.elasticsearch.action.admin.indices.status.IndicesStatusRequest@2a2e0135]
# org.elasticsearch.index.IndexShardMissingException: [foo][2] missing
# at org.elasticsearch.index.service.InternalIndexService.shardSafe(InternalIndexService.java:165)
# at org.elasticsearch.action.admin.indices.status.TransportIndicesStatusAction.shardOperation(TransportIndicesStatusAction.java:148)
# at org.elasticsearch.action.admin.indices.status.TransportIndicesStatusAction.shardOperation(TransportIndicesStatusAction.java:57)
# at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.performOperation(TransportBroadcastOperationAction.java:238)
# at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.access$200(TransportBroadcastOperationAction.java:126)
# at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction$1.run(TransportBroadcastOperationAction.java:195)
# at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
# at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
# at java.lang.Thread.run(Thread.java:680)
for i in {1..200}
do
echo ''
echo $i
# delete index
curl -XDELETE http://localhost:9200/foo
# create index
curl -XPUT http://localhost:9200/foo -d "
{\"analysis.analyzer.default.tokenizer\":\"standard\",\"analysis.analyzer.default.filter\":[\"standard\",\"lowercase\",\"porterStem\"]}
"
# get status
curl -XPOST http://localhost:9200/foo/_refresh
curl -XGET http://localhost:9200/foo/_status | grep 'IndexShardMissingException'
#fail if no results returned
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo 'error'
exit 1
else
echo 'ok'
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment