public_docs/useful_elasticsearch_commands.md
Arif Ali 3ff0161327 Add retry reroute doc for elastic
Signed-off-by: Arif Ali <mail@arif-ali.co.uk>
2022-05-23 22:41:11 +00:00

1.2 KiB

Useful Elasticsearch Commands

Get the shards

curl -X GET "localhost:9200/_cat/shards"

Get the indices from Elasticsearch

curl -X GET "localhost:9200/_cat/indices"

Get version details of elasticsearch

curl -X GET "localhost:9200"

Delete an index

curl -X DELETE "localhost:9200/graylog_20"

Get current health

curl -X GET "localhost:9200/_cat/health"

Disable shard allocation

curl -X PUT "localhost:9200/_cluster/settings" \
    -H 'Content-Type: application/json' \
    -d '{ "persistent": { "cluster.routing.allocation.enable":"none" }}'

Stop indexing and perform a sync'd flush

curl -X POST "localhost:9200/_flush/synced"

Enable allocation

curl -X PUT "localhost:9200/_cluster/settings" \
    -H 'Content-Type: application/json' \
    -d '{"persistent": { "cluster.routing.allocation.enable": null}}'
curl -X PUT "localhost:9200/_all/_settings" \
    -H "Content-Type: application/json" \
    -d '{"index.blocks.read_only_allow_delete": false}'

Retry rerouting

curl -s -X POST 'http://localhost:9200/_cluster/reroute?retry_failed=true&pretty'