/**
* 查看索引中每个分片存储的文档大小;
*/
curl "localhost:9200/_cat/shards/<index_name>?pretty"
索引名称 | 索引序号 | 是否分配 | 不知道 | 分片存储文档大小 | 地址 | 不知道
srx_traffic_20201231 2 p STARTED 519790 158.2mb 127.0.0.1 xURjCvw
srx_traffic_20201231 4 p STARTED 521135 158.5mb 127.0.0.1 xURjCvw
srx_traffic_20201231 1 p STARTED 520264 158.3mb 127.0.0.1 xURjCvw
srx_traffic_20201231 3 p STARTED 519263 157.7mb 127.0.0.1 xURjCvw
srx_traffic_20201231 0 p STARTED 519022 157.9mb 127.0.0.1 xURjCvw
/**
* 列出所有索引
*/
curl "localhost:9200/_cat/indices?v"
/**
* 查看指定索引信息;
*/
curl "localhost:9200/_cat/indices/<index_name>?pretty"
/**
* 判断索引是否存在
*/
curl -XHEAD -i "localhost:9200/<index_name>"
/**
* 查看索引mapping;
*/
curl "localhost:9200/<index_name>/_mapping?pretty"
/**
* 关闭索引
*/
curl -X POST "localhost:9200/<index_name>/_close?pretty"
/**
* 打开索引
*/
curl -X POST "localhost:9200/<index_name>/_open?pretty"
/**
* 查看集群设置
*/
curl -X GET "localhost:9200/_cluster/settings?pretty"
/**
* 修改search.max_buckets设置
*/
curl -X PUT "localhost:9200/_cluster/settings" -H "Content-Type:application/json" -d '{"persistent":{"search.max_buckets":50000}}'
/**
* 关闭集群节点监控数据搜集
*/
curl -XPUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d '{"persistent": {"xpack.monitoring.collection.enabled": false}}'
/**
* 设置节点的洪水位阈值;
*/
curl -XPUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d '{"transient": {"cluster.routing.allocation.disk.watermark.flood_stage":"98%"}}'
/**
* 设置节点的低警戒水位线阈值
*/
curl -XPUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d '{"transient": {"cluster.routing.allocation.disk.watermark.low":"98%"}}'
/**
* 设置节点的高警戒水位线阈值
*/
curl -XPUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d '{"transient": {"cluster.routing.allocation.disk.watermark.high":"98%"}}'
/**
* 查看模板;
*/
curl -XGET localhost:9200/_template/<template_name>?pretty
/**
* 取消所有索引的只读
*/
curl -XPUT -H "Content-Type: application/json" http://127.0.0.1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": false}'
/**
* 取消指定索引的只读
*/
curl -XPUT -H "Content-Type: application/json" http://127.0.0.1:9200/<index_name>/_settings -d '{"index.blocks.read_only_allow_delete": false}'
/**
* 查看所有索引的设置
*/
curl -XGET http://127.0.0.1:9200/_all/_settings?pretty
/**
* 查看指定索引的设置
*/
curl -XGET http://127.0.0.1:9200/<index_name>/_settings?pretty
/**
* 插入数据
*/
curl -XPOST -H "Content-Type: application/json" http://127.0.0.1:9200/srx_traffic_20210406/_doc -d '{"x_src_ip":"192.168.0.1","x_timestamp":"2021-04-06T15:13:55.000+08:00","x_direction":"out","x_source_areacode":"","x_source_country":"","x_source_province":"","x_source_city":"","x_source_wgs_lon":"","x_source_wgs_lat":"","x_destination_areacode":"US","x_destination_country":"......","x_destination_province":"","x_destination_city":"","x_destination_wgs_lon":"-95.712891","x_destination_wgs_lat":"37.09024","facility":1,"level":6,"timestamp":"2021-04-06T15:13:30.038+08:00","hostname":"MS-SRX1500-Internet","msgid":"RT_FLOW_SESSION_DENY","source_address":"192.168.6.17","source_port":362,"destination_address":"8.8.8.8","destination_port":20889,"nat_source_address":"0.0.0.0","nat_source_port":0,"nat_destination_address":"0.0.0.0","nat_destination_port":0,"src_nat_rule_type":"","src_nat_rule_name":"","dst_nat_rule_type":"","dst_nat_rule_name":"","protocol_id":"1","policy_name":"test","source_zone_name":"trust","destination_zone_name":"dianxintong","session_id_32":"","packets_from_client":0,"bytes_from_client":0,"packets_from_server":0,"bytes_from_server":0,"elapsed_time":0,"packet_incoming_interface":"ge-0/0/2.0"}'
/**
* 删除索引
*/
curl -XDELETE http://localhost:9200/<index_name>?pretty
/**
* 删除所有索引
*/
curl -XDELETE http://localhost:9200/_all?pretty
/**
* 获取节点磁盘信息
*/
curl -XGET localhost:9200/_cat/allocation?v
/**
* 常见查询
*/
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/thread_pool/{thread_pools}
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
/_cat/nodeattrs
/_cat/repositories
/_cat/snapshots/{repository}
/_cat/templates
ES常用命令总结
最新推荐文章于 2024-04-21 21:50:20 发布