Search with query DSL elasticsearch
Find last 5 error log entries
curl -X GET 'http://es:9200/logs-*/_search?pretty' -H 'Content-Type: application/json' -d '{"query":{"match":{"level":"error"}},"size":5}'
more elasticsearch
all 19 commands →
Show shards allocation
curl -s 'http://es:9200/_cat/shards?v&h=index,shard,prirep,state,node,unassigned.reason'
Force shard re-allocation
curl -X POST http://es:9200/_cluster/reroute?retry_failed=true
Update index settings
curl -X PUT 'http://es:9200/my-index/_settings' -H 'Content-Type: application/json' -d '{"index":{"number_of_replicas":1}}'
Create index template
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}}}'
Snapshot to repository
curl -X PUT 'http://es:9200/_snapshot/my_repo/snap1?wait_for_completion=true'