elasticsearch

19 commands

19 shown

Cluster health Show cluster status: green/yellow/red, shards, nodes curl -s http://localhost:9200/_cluster/health | jq . #elasticsearch#monitoring List indices Tabular index listing sorted by size curl -s 'http://localhost:9200/_cat/indices?v&h=index,health,pri,rep,docs.count,store.size&s=store.size:desc' #elasticsearch Delete index Remove an index and all its data curl -X DELETE http://localhost:9200/<index> #elasticsearch Get index settings Inspect number of shards, replicas, refresh interval curl -s http://localhost:9200/<index>/_settings | jq . #elasticsearch Reindex Copy documents from one index to another curl -X POST http://localhost:9200/_reindex -H 'Content-Type: application/json' -d '{"source":{"index":"old"},"dest":{"index":"new"}}' #elasticsearch Force merge index Reduce segment count; useful before making index read-only curl -X POST 'http://localhost:9200/<index>/_forcemerge?max_num_segments=1' #elasticsearch Node stats Show all ES nodes with JVM heap, load, roles curl -s http://localhost:9200/_cat/nodes?v #elasticsearch#monitoring Search query Full-text search for documents matching a term curl -s -X POST http://localhost:9200/<index>/_search -H 'Content-Type: application/json' -d '{"query":{"match":{"message":"error"}}}' #elasticsearch Snapshot create Create a snapshot to the registered repository curl -X PUT http://localhost:9200/_snapshot/<repo>/<snapshot> #elasticsearch ILM explain index Show current ILM lifecycle phase and action for an index curl -s 'http://localhost:9200/<index>/_ilm/explain' | jq '.indices | to_entries[] | {index:.key, phase:.value.phase, action:.value.action}' #elasticsearch Check cluster health Show cluster status: green/yellow/red with shard counts curl -s http://es:9200/_cluster/health?pretty #elasticsearch#monitoring List indices with size All indices sorted by store size (largest first) curl -s 'http://es:9200/_cat/indices?v&s=store.size:desc' #elasticsearch#monitoring Delete old index Remove a specific index (irreversible) curl -X DELETE http://es:9200/logs-2024.01.01 #elasticsearch Search with query DSL 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}' #elasticsearch#debug Show shards allocation Show all shards with their state and unassigned reason curl -s 'http://es:9200/_cat/shards?v&h=index,shard,prirep,state,node,unassigned.reason' #elasticsearch#debug Force shard re-allocation Retry allocation of all failed/unassigned shards curl -X POST http://es:9200/_cluster/reroute?retry_failed=true #elasticsearch#debug Update index settings Change replica count on a live index curl -X PUT 'http://es:9200/my-index/_settings' -H 'Content-Type: application/json' -d '{"index":{"number_of_replicas":1}}' #elasticsearch Create index template Auto-configure new indices matching logs-* 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}}}' #elasticsearch Snapshot to repository Create a cluster snapshot synchronously curl -X PUT 'http://es:9200/_snapshot/my_repo/snap1?wait_for_completion=true' #elasticsearch
no commands match