mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
Added GET API Elasticsearch plugin
Manage _cat API Added PUT, POST, DELETE commands. Added options for autocomplete
This commit is contained in:
parent
192de6bcff
commit
aa9a96f327
2 changed files with 73 additions and 0 deletions
28
plugins/elasticsearch/_GET
Normal file
28
plugins/elasticsearch/_GET
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#compdef GET
|
||||||
|
|
||||||
|
local -a options
|
||||||
|
options=(
|
||||||
|
'_cache/clear:Allows to clear all caches for all indices'
|
||||||
|
'_cluster/health:Cluster status health'
|
||||||
|
'_cluster/nodes/_local/_shutdown:Shutdown local node'
|
||||||
|
'_cluster/pending_tasks:Returns a list of any cluster-level changes which have not yet been executed'
|
||||||
|
'_cluster/settings:Cluster settings'
|
||||||
|
'_cluster/state:Allows to get a comprehensive state information of the whole cluster'
|
||||||
|
'_cluster/stats:Allows to retrieve statistics from a cluster wide perspective'
|
||||||
|
'_flush:Allows to flush all indices'
|
||||||
|
'_nodes/hot_threads:Allowing to get the current hot threads on each node in the cluster'
|
||||||
|
'_nodes/stats/indices:Field data memory usage on node level'
|
||||||
|
'_nodes/stats:Allows to retrieve all of the cluster nodes statistics'
|
||||||
|
'_nodes:Allows to retrieve all of the cluster nodes information'
|
||||||
|
'_optimize?max_num_segments=1:Allows to optimize all indices'
|
||||||
|
'_recovery:Cluster-wide recovery status'
|
||||||
|
'_recovery?detailed=true:Cluster-wide recovery status with details'
|
||||||
|
'_refresh:Allows to explicitly refresh all indices'
|
||||||
|
'_segments:Include segments for all indices'
|
||||||
|
'_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
|
||||||
45
plugins/elasticsearch/elasticsearch.plugin.zsh
Normal file
45
plugins/elasticsearch/elasticsearch.plugin.zsh
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Description
|
||||||
|
# -----------
|
||||||
|
#
|
||||||
|
# You can use Elastichsearch GET API like in Marvel sense console:
|
||||||
|
# GET /
|
||||||
|
# GET _cluster/health
|
||||||
|
# GET _nodes/stats
|
||||||
|
# GET _stats/fielddata?fields=*
|
||||||
|
# GET _nodes/stats/indices/fielddata?fields=*
|
||||||
|
#
|
||||||
|
# You have do install json_reformat (http://dev.man-online.org/package/main/yajl-tools/)
|
||||||
|
# to format json
|
||||||
|
#
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Author
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# * Fedele Mantuano (Twitter: @fedelemantuano)
|
||||||
|
#
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
alias ech='GET _cluster/health'
|
||||||
|
alias ecs='GET _cluster/state'
|
||||||
|
alias ens='GET _nodes/stats'
|
||||||
|
alias esf='GET _stats/fielddata'
|
||||||
|
|
||||||
|
# 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/"$@" }
|
||||||
|
else
|
||||||
|
GET() { curl -s -XGET http://localhost:9200/"$@" }
|
||||||
|
fi
|
||||||
|
|
||||||
|
# HEAD
|
||||||
|
HEAD() { curl -s -XHEAD -i http://localhost:9200/"$@" }
|
||||||
|
|
||||||
|
# DELETE
|
||||||
|
DELETE() { curl -s -XDELETE http://localhost:9200/"$@" }
|
||||||
|
|
||||||
|
# PUT
|
||||||
|
PUT() { curl -s -XPUT http://localhost:9200/"$@" }
|
||||||
|
|
||||||
|
# POST
|
||||||
|
POST() { curl -s -XPOST http://localhost:9200/"$@" }
|
||||||
Loading…
Add table
Add a link
Reference in a new issue