2022-01-25 23:43:25 +00:00
|
|
|
# Useful Elasticsearch Commands
|
|
|
|
|
|
|
|
Get the shards
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X GET "localhost:9200/_cat/shards"
|
|
|
|
```
|
|
|
|
|
|
|
|
Get the indices from Elasticsearch
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X GET "localhost:9200/_cat/indices"
|
|
|
|
```
|
|
|
|
|
|
|
|
Get version details of elasticsearch
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X GET "localhost:9200"
|
|
|
|
```
|
|
|
|
|
2022-03-14 13:29:43 +00:00
|
|
|
Delete an index
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X DELETE "localhost:9200/graylog_20"
|
|
|
|
```
|
|
|
|
|
2022-01-25 23:43:25 +00:00
|
|
|
Get current health
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X GET "localhost:9200/_cat/health"
|
|
|
|
```
|
|
|
|
|
|
|
|
Disable shard allocation
|
|
|
|
|
|
|
|
```bash
|
|
|
|
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
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X POST "localhost:9200/_flush/synced"
|
|
|
|
```
|
|
|
|
|
|
|
|
Enable allocation
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X PUT "localhost:9200/_cluster/settings" \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d '{"persistent": { "cluster.routing.allocation.enable": null}}'
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X PUT "localhost:9200/_all/_settings" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-d '{"index.blocks.read_only_allow_delete": false}'
|
|
|
|
```
|
2022-05-23 22:41:11 +00:00
|
|
|
|
|
|
|
Retry rerouting
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -s -X POST 'http://localhost:9200/_cluster/reroute?retry_failed=true&pretty'
|
|
|
|
```
|