本博客参考官网文档及多篇网络博客,仅供各位博友参考。如有引用,请注明引用地址。
- 查询所有数据
GET _search
{
"query": {
"match_all": {}
}
}
- 获取当前集群线程池使用情况
GET _cat/thread_pool?v
- 监控Fielddata 的使用
(1)按索引使用 indices-stats API :
GET /_stats/fielddata?fields=*
(2)按节点使用 nodes-stats API :
GET /_nodes/stats/indices/fielddata?fields=*
(3)按索引节点:
GET /_nodes/stats/indices/fielddata?level=indices&fields=*
- 查看均衡过程进度
GET /_cat/recovery?active_only=true
(1)查看恢复
GET _cat/recovery
GET _cat/recovery/{index}
- 查看集群设置
GET _settings
- 查看lock memory是否设置成功
GET /_nodes?filter_path=**.mlockall
- 查看节点
GET /_nodes
curl -XGET 'http://localhost:9200/_nodes/stats?pretty=true'
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2/stats?pretty=true'
curl -XGET 'http://localhost:9200/_nodes/process'
curl -XGET 'http://localhost:9200/_nodes/_all/process'
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2,192.168.1.3/jvm,process'
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2,192.168.1.3/info/jvm,process'
curl -XGET 'http://localhost:9200/_nodes/192.168.1.2,192.168.1.3/_all'
curl -XGET 'http://localhost:9200/_nodes/hot_threads'
查询节点设置
curl -XGET http://172.168.1.203:9200/_nodes/stats
- 节点统计信息
curl -XGET 'http://172.168.1.201:9200/_nodes/stats'
curl -XGET 'http://172.168.1.201:9200/_nodes/stats/os'
curl -XGET 'http://172.168.1.201:9200/_nodes/stats/process'
curl -XGET http://172.168.1.201:9200/_nodes/stats/indices/fielddata?fields=*
hot threads api,高消耗的线程在做什么
curl -XGET 'http://172.168.1.201:9200/_nodes/hot_threads'
- 查看别名
GET _aliases
GET _cat/aliases
GET _cat/aliases/{alias}
- 查看segment
GET _cat/segments?v
GET _cat/segments
GET _cat/segments/{index}
- 查看mapping
查看指定type
GET _mapping/t_vitualacc
查看所有的mapping
GET _mapping
获取mapping
curl -XGET http://localhost:9200/{index}/{type}/_mapping
- 查看集群健康状态
GET _cat/health?v
查看集群健康状态,索引级别
GET _cluster/health?level=indices
查看集群健康状态,分片级别
GET _cluster/health?level=shards
集群状态
curl -XGET localhost:9200/_cluster/health?pretty=true
pretty=true表示格式化输出
level=indices 表示显示索引状态
level=shards 表示显示分片信息
- 查看节点分布
GET _cat/nodeattrs
- 查看分片
GET _cat/shards?v
GET _cat/shards
GET _cat/shards/{index}
查看分片恢复
GET _cat/recovery?v&h=i,s,t,ty,st,fp,bp,shost,thost
- 查看索引
GET _cat/indices?v
GET _cat/indices
GET _cat/indices/{index}
- 查看存储分布
GET _cat/allocation/_master
GET _cat/allocation
- 查看es集群文档总数
GET /_cat/count
GET /_cat/count/{index}
- 查看(主/从)节点
GET /_cat/master
GET /_cat/nodes
- 查看索引
GET _cat/indices
GET _cat/indices/dc_test_event1*
curl -XGET http://172.168.1.201:9200/_cat/indices
curl -XGET http://172.168.1.201:9200/_cat/indices/dc_test_object1*
- 查看集群正在执行的任务
GET _cat/pending_tasks
curl -XGET localhost:9200/_cluster/pending_tasks?pretty=true
查询集群等待任务
GET _cluster/pending_tasks
curl -XGET 'http://172.168.1.201:9200/_cluster/pending_tasks'
获取当前查询任务列表
GET _tasks
curl -XGET 'http://172.168.1.201:9200/_tasks'
- 查看线程池
GET _cat/thread_pool
- 查看插件
GET _cat/plugins
- 查看fielddata
GET _cat/fielddata
GET _cat/fielddata/{fields}
- 显示集群系统信息
包括CPU JVM等等
curl -XGET 172.168.1.199:9200/_cluster/stats?pretty=true
- 集群的详细信息
包括节点、分片等
curl -XGET 172.168.1.199:9200/_cluster/state?pretty=true
- 获取文档
curl -XGET 'http://localhost:9200/{index}/{type}/{id}'
构造数据
curl -XPOST 'http://localhost:9200/{index}/{type}/{id}' –d '{"a":"avalue","b":"bvalue"}'
- 查看索引设置
GET index_test/_settings
- 分词器
GET _analyze
{
"analyzer": "ik_max_word",
"text": "中华人民\\n共和国"
}
GET _analyze
{
"analyzer": "ik_smart",
"text": "中华人民\\n共和国"
}
分词器分词
GET /ipearl_2501_event_20181023_001/_analyze
{
"analyzer": "text_analyzer",
"text": "13915922365"
}
GET _analyze
{
"analyzer": "standard",
"text": "13915922365"
}
索引自定义的分词器
GET test/_analyze
{
"analyzer": "text_stop_analyzer",
"text": "illegal argument exception"
}
ES还内置了分词器和过滤器
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-tokenizers.htmlstandard]
(1)edge_ngram
(2)keyword
(3)letter
(4)lowercase
(5)ngram
(6)whitespace
(7)pattern
(8)uax_email_url
(9)path_hierarchy
(10)ascii folding
(11)length
(12)lowercase
(13)uppercase
(14)nGram
(15)edge_ngram
(16)porter_stem
(17)shingle
(18)stop
(19)word_delimiter
(20)stemmer
(21)stemmer_override
(22)keyword_marker
(23)keyword_repeat
(24)kstem
(25)snowball
(26)phonetic
(27)synonym
(28)reverse
(29)elision
(30)truncate
(31)unique
(32)pattern_capture
(33)pattern_replace
(34)trim
(35)limit
(36)hunspell
(37)common_grams
(38)normalization
(39)delimited_payload
(40)keep_words
- 清除缓存
GET _cache/clear
- 查看路由
GET /test/_routing
- 查看快照
GET _snapshot/_all
查询快照
GET /_snapshot/share_data/snapshot_5
查询快照的状态
GET _snapshot/share_data/snapshot_1/_status
恢复快照
GET ipearl_test_event_20170101_002/_recovery
- 查询某字段的准确值
GET dtest/_search?q=varchar_id:1,silio
GET twitter/tweet/_search?q=user:kimchy