1、獲取cat命令列表:
curl –X GET 127.0.0.1:9200/_cat/
2、帶用戶名密碼查看索引信息
curl –X GET -u username:password? 'http://192.168.90.161:9200/_cat/'
3、查看索引信息及空間占用:
?
curl -XGET 127.0.0.1:9200/_cat/indices?v
?
4、清理指定索引空間
curl -X POST "127.0.0.1:9200/索引名/_delete_by_query" -H 'Content-Type: application/json' -d'
?{
?"query": {
?"match_all": {
?}
?}
?}
?'
5、刪除索引
curl??-X?DELETE?"http://127.0.0.1:9200/索引名"
6、刪除30天前的索引記錄
curl -X POST "127.0.0.1:9200/索引名/_delete_by_query" -H 'Content-Type: application/json' -d'
{
??? "query": {
??????? "range": {
??????????? "@timestamp": {
??????????????? "lt": "now-30d",
??????????????? "format": "epoch_millis"
??????????? }
??????? }
? ??}
}
7、crontab 定時清理30天前數(shù)據(jù)
0 1 * * * /usr/bin/curl -H'Content-Type:application/json' -d'{"query":{"range":{"@timestamp":{"lt":"now-30d","format":"epoch_millis"}}}}' -XPOST "http://127.0.0.1:9200/*-*/_delete_by_query?pretty" > /tmp/elk_clean.txt
8、修改帶密碼的索引副本數(shù)量文章來源:http://www.zghlxwxcb.cn/news/detail-705969.html
curl -u "elastic" -X PUT "192.168.1.55:9200/*/_settings" -H 'Content-Type: application/json' -d'
{
"index" : {
"number_of_replicas" : 2
}
}
'
?文章來源地址http://www.zghlxwxcb.cn/news/detail-705969.html
到了這里,關于ES 查看、刪除索引命令的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!