diff --git a/plugins/elasticsearch/README.md b/plugins/elasticsearch/README.md index d9c89c672..2c398893d 100644 --- a/plugins/elasticsearch/README.md +++ b/plugins/elasticsearch/README.md @@ -1,4 +1,4 @@ -elasticsearch +Elasticsearch ======= This plugin makes easy to use Elasticsearch API and it also offering autocomplete for common APIs. There are [`GET`](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html), @@ -17,6 +17,15 @@ Examples usage: You should install [`json_reformat`](http://dev.man-online.org/package/main/yajl-tools/) to format json output. +Instructions +------- + +If you'd prefer to specify an explicit Elasticsearch node client to query, you can set variable like so in `.zshrc`: + +`export CLIENT_ELK_NODE=client_node` + +Default is `localhost`. + Aliases ------- diff --git a/plugins/elasticsearch/_GET b/plugins/elasticsearch/_GET index aad95d43e..a08ec8e33 100644 --- a/plugins/elasticsearch/_GET +++ b/plugins/elasticsearch/_GET @@ -23,7 +23,6 @@ options=( '_shutdown:Shutdown all nodes' '_stats/fielddata:Field data memory usage on index level' '_stats:High level aggregation and index level stats for all indices' - '_status:Status information of all indices' '_template:List of all index templates' ) _describe 'values' options diff --git a/plugins/elasticsearch/elasticsearch.plugin.zsh b/plugins/elasticsearch/elasticsearch.plugin.zsh index 60dc0e05f..4045c2710 100644 --- a/plugins/elasticsearch/elasticsearch.plugin.zsh +++ b/plugins/elasticsearch/elasticsearch.plugin.zsh @@ -3,21 +3,25 @@ alias ecs='GET _cluster/state' alias ens='GET _nodes/stats' alias esf='GET _stats/fielddata' +if [ -z ${CLIENT_ELK_NODE} ]; then + export CLIENT_ELK_NODE=localhost +fi + # GET if which json_reformat > /dev/null 2>&1; then - GET() { curl -s -XGET http://localhost:9200/"$@" | json_reformat 2>/dev/null || curl -s -XGET http://localhost:9200/"$@" } + GET() { curl -s -XGET http://${CLIENT_ELK_NODE}:9200/"$@" | json_reformat 2>/dev/null || curl -s -XGET http://${CLIENT_ELK_NODE}:9200/"$@" } else - GET() { curl -s -XGET http://localhost:9200/"$@" } + GET() { curl -s -XGET http://${CLIENT_ELK_NODE}:9200/"$@" } fi # HEAD -HEAD() { curl -s -XHEAD -i http://localhost:9200/"$@" } +HEAD() { curl -s -XHEAD -i http://${CLIENT_ELK_NODE}:9200/"$@" } # DELETE -DELETE() { curl -s -XDELETE http://localhost:9200/"$@" } +DELETE() { curl -s -XDELETE http://${CLIENT_ELK_NODE}:9200/"$@" } # PUT -PUT() { curl -s -XPUT http://localhost:9200/"$@" } +PUT() { curl -s -XPUT http://${CLIENT_ELK_NODE}:9200/"$@" } # POST -POST() { curl -s -XPOST http://localhost:9200/"$@" } +POST() { curl -s -XPOST http://${CLIENT_ELK_NODE}:9200/"$@" }