mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-17 04:29:14 +02:00
Added environment variable to change client node to query
This commit is contained in:
parent
e806b1ae60
commit
9b983f3c6b
3 changed files with 20 additions and 8 deletions
|
|
@ -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
|
||||
-------
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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/"$@" }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue