Skip to content

Instantly share code, notes, and snippets.

@holmesconan
Created April 30, 2016 05:56
Show Gist options
  • Save holmesconan/ae95e4971721d5f8552c4cb1bae7d3a0 to your computer and use it in GitHub Desktop.
Save holmesconan/ae95e4971721d5f8552c4cb1bae7d3a0 to your computer and use it in GitHub Desktop.
ElasticSearch bash client.
#!/bin/bash
action=$1; uri=$2; shift; shift;
case "$action" in
GET)
curl -XGET "localhost:9200/$uri?pretty=1" "$@"
;;
PUT)
curl -XPUT "localhost:9200/$uri?pretty=1" "$@"
;;
POST)
curl -XPOST "localhost:9200/$uri?pretty=1" "$@"
;;
DELETE)
curl -XDELETE "localhost:9200/$uri?pretty=1"
;;
*)
echo "Unknown action: $action"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment