常见ElasticSearch API

查看符合某个模式的索引, 输出标头, 并按照索引大小倒序排列. 参考 cat indices API

1
GET _cat/indices/some-*20210806*?v&s=ss:desc

查看某个索引的设置

1
GET /some-index-20210806/_settings

查看符合某个模式的模板设置

1
GET _template/some-index-*

查看某个索引下分片的分布情况, 输出表头.

1
GET _cat/shards/some-index-20210806?v

查看集群设置

1
GET /_cluster/settings

查看集群中正在进行的任务. 例如reindex

1
GET /_tasks?detailed=true&actions=*reindex

终止集群中某个正在进行的任务,根据上一条中查到的任务ID. 参考:Task Management API

1
POST _tasks/nodeID:taskID/_cancel

删除某个索引

1
DELETE /some-index-20210806

调整某个模板设置(举例)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
PUT /_template/some-template-1
{
"order": 9,
"index_patterns": [
"some-index-*"
],
"settings": {
"index": {
"number_of_shards": "30",
"routing": {
"allocation": {
"include": {
"temperature": "hot"
},
"require": {
"temperature": "hot"
}
}
}
}
},
"mappings": {
"doc": {
"dynamic_templates": [
{
"message_field": {
"path_match": "message",
"mapping": {
"norms": false,
"type": "text"
},
"match_mapping_type": "string"
}
},
{
"string_fields": {
"mapping": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"match_mapping_type": "string",
"match": "*"
}
}
],
"date_detection": false,
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "keyword"
}
}
}
},
"aliases": {}
}