Skip to content

Instantly share code, notes, and snippets.

@miku
Last active August 29, 2015 14:01
Show Gist options
  • Save miku/8b15e43d72d0dca3aeaf to your computer and use it in GitHub Desktop.
Save miku/8b15e43d72d0dca3aeaf to your computer and use it in GitHub Desktop.
Elasticsearch wrapper (cat and top)
function escat() {
INDEXCAT="curl -sL localhost:9200/_cat/indices"
if [ $# -eq 0 ]; then
$INDEXCAT|sort -k2
else
case $1 in
-s) $INDEXCAT|sort -nrk 5; shift 1;;
-S) $INDEXCAT|sort -nrk 5; shift 1;;
-n) $INDEXCAT|sort -k 2; shift 1;;
-t) $INDEXCAT|sort -k 1; shift 1;;
*) shift 1;;
esac
fi
}
function estop() {
clear
while true; do escat "$@"; sleep 2; clear; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment