Show shard allocation

Show all shards with their state and the reason why a shard is unassigned

curl -s 'http://es:9200/_cat/shards?v&h=index,shard,prirep,state,node,unassigned.reason'

tool
elasticsearch19 commands
tags
elasticsearchdebug

More elasticsearch commands

  • curl -X POST http://es:9200/_cluster/reroute?retry_failed=true

    Retry allocation of shards that failed to allocate

  • curl -X PUT 'http://es:9200/my-index/_settings' -H 'Content-Type: application/json' -d '{"index":{"number_of_replicas":1}}'

    Change the number of replicas on a working index without closing it

  • curl -X PUT 'http://es:9200/_index_template/logs-tpl' -H 'Content-Type: application/json' -d '{"index_patterns":["logs-*"],"template":{"settings":{"number_of_shards":2}}}'

    Set default settings for new indices that match logs-*

  • curl -X PUT 'http://es:9200/_snapshot/my_repo/snap1?wait_for_completion=true'

    Create a cluster snapshot and wait until it finishes

  • curl -s http://localhost:9200/_cluster/health | jq .

    Show cluster status (green, yellow or red), shards and nodes

all 19 elasticsearch commands