Delete an old index

Delete one index, there is no undo

curl -X DELETE http://es:9200/logs-2024.01.01

tool
elasticsearch19 commands
tags
elasticsearch

More elasticsearch commands

  • curl -X GET 'http://es:9200/logs-*/_search?pretty' -H 'Content-Type: application/json' -d '{"query":{"match":{"level":"error"}},"size":5}'

    Find 5 log entries with level "error" (no sorting, so not always the newest)

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

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

  • 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-*

all 19 elasticsearch commands