索引统计
1、docs - 文档数量
可以不指定索引 、也可以指定具体索引、也可以指定模糊索引:
//获取所有索引的docs数量
GET /_stats/docs
//获取指定索引的docs数量
GET /bank/_stats/docs
//获取同类索引的docs数量
GET /log-*/_stats/docs
返回结果:
{
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_all" : {
"primaries" : {
"docs" : {
"count" : 1000,
"deleted" : 2
}
},
"total" : {
"docs" : {
"count" : 1000,
"deleted" : 2
}
}
},
"indices" : {
"bank" : {
"uuid" : "1Ny9g32eTSutDG8gfLzQZg",
"primaries" : {
"docs" : {
"count" : 1000,
"deleted" : 2
}
},
"total" : {
"docs" : {
"count" : 1000,
"deleted" : 2
}
}
}
}
}
-
_shards :分片信息:总数、成功返回数、失败返回数
-
_all :统计的总信息
- primaries:主分片上的统计信息
- total : 所有分片(主分片+副本分片)上的统计信息
-
indices :索引维度统计信息详情
2、store - 索引存储大小
//获取所有索引的store大小
GET /_stats/store
//获取所有索引的store大小
GET /bank/_stats/store
//获取同类索引的store大小
GET /log-*/_stats/store
返回:单位字节
{
"_shards": {
"total": 3565,
"successful": 3565,
"failed": 0
},
"_all": {
"primaries": {
"store": {
"size_in_bytes": 34003971241
}
},
"total": {
"store": {
"size_in_bytes": 67412754240
}
}
},
"indices": {
"book-20210107": {
"uuid": "m0txeABPUtmNQ3u-VgIRUg",
"primaries": {
"store": {
"size_in_bytes": 5470681
}
},
"total": {
"store": {
"size_in_bytes": 10941362
}
}
},
...
}
}
-
_shards :分片信息:总数、成功返回数、失败返回数
-
_all :统计的总信息
- primaries:主分片上的统计信息
- total : 所有分片(主分片+副本分片)上的统计信息
-
indices :索引维度统计信息详情
3、indexing - 索引操作统计信息
索引操作信息(CRUD)统计
//获取所有索引的indexing信息
GET /_stats/indexing
//获取所有索引的indexing信息
GET /bank/_stats/indexing
//获取同类索引的indexing信息
GET /log-*/_stats/indexing
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"indexing": {
// 索引操作总次数
"index_total": 3093133,
// 索引操作总耗时
"index_time_in_millis": 349332,
// 当前正在执行索引操作的个数
"index_current": 0,
// 失败的索引操作次数
"index_failed": 0,
// 执行删除索引操作的次数
"delete_total": 0,
// 删除索引操作总耗时
"delete_time_in_millis": 0,
// 当前正在执行删除索引操作的个数
"delete_current": 0,
// 空更新总次数(检测到空更新的次数)
"noop_update_total": 0,
// 索引是否处在merge throttling control(合并节流控制状态)
"is_throttled": false,
// 索引处在merge throttling control(合并节流状态)的时间开销
"throttle_time_in_millis": 0
}
},
"total": {
"indexing": {
"index_total": 6986261,
"index_time_in_millis": 783341,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
}
}
},
"indices": {
"log-20210109": {
"uuid": "_5G171lSRsGez7_tKtQyDw",
"primaries": {
"indexing": {
"index_total": 221821,
"index_time_in_millis": 25891,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
}
},
"total": {
"indexing": {
"index_total": 443642,
"index_time_in_millis": 47894,
"index_current": 0,
"index_failed": 0,
"delete_total": 0,
"delete_time_in_millis": 0,
"delete_current": 0,
"noop_update_total": 0,
"is_throttled": false,
"throttle_time_in_millis": 0
}
}
},
...
}
}
4、get - 索引get统计信息
get api 操作统计信息,报错missing统计。
//获取所有索引的get信息
GET /_stats/get
//获取所有索引的get信息
GET /bank/_stats/get
//获取同类索引的get信息
GET /log-*/_stats/get
返回:
{
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"_all": {
"primaries": {
"get": {
// get api总调用次数
"total": 0,
// get api总耗时。
"time_in_millis": 0,
// 命中的次数
"exists_total": 0,
// 命中的操作总耗时
"exists_time_in_millis": 0,
// 未命中的总次数
"missing_total": 0,
// 未命中的操作的总耗时
"missing_time_in_millis": 0,
// 当前正在执行的个数
"current": 0
}
},
"total": {
"get": {
"total": 0,
"time_in_millis": 0,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
}
}
},
"indices": {
"book-20210109": {
"uuid": "_SRsG5Ge171lQz7_tKtyDw",
"primaries": {
"get": {
"total": 0,
"time_in_millis": 0,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
}
},
"total": {
"get": {
"total": 0,
"time_in_millis": 0,
"exists_total": 0,
"exists_time_in_millis": 0,
"missing_total": 0,
"missing_time_in_millis": 0,
"current": 0
}
}
},
...
}
}
5、search - 索引search统计信息
搜索统计信息,包括建议统计信息。
//获取所有索引的search信息
GET /_stats/search
//获取所有索引的search信息
GET /bank/_stats/search
//获取同类索引的search信息
GET /log-*/_stats/search
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"search": {
// 正在打开的查询上下文个数
"open_contexts": 0,
// 查询出来的总数据条数
"query_total": 5957,
// 查询阶段所耗费的时间
"query_time_in_millis": 26508,
// 当前正在查询个数
"query_current": 0,
// Fetch操作的次数
"fetch_total": 689,
// Fetch阶段总耗时时间
"fetch_time_in_millis": 659,
// 正在fetch的次数
"fetch_current": 0,
// 通过scroll api查询数据总条数
"scroll_total": 305,
// 通过scroll api总耗时时间
"scroll_time_in_millis": 28225774,
// 当前滚动API调用次数
"scroll_current": 0,
// 通过suggest api获取的推荐总数量
"suggest_total": 0,
// suggest总耗费时间
"suggest_time_in_millis": 0,
// 正在执行suggest api的个数
"suggest_current": 0
}
},
"total": {
"search": {
"open_contexts": 0,
"query_total": 12745,
"query_time_in_millis": 48163,
"query_current": 0,
"fetch_total": 1573,
"fetch_time_in_millis": 1796,
"fetch_current": 0,
"scroll_total": 744,
"scroll_time_in_millis": 68167255,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
}
}
},
"indices": {
"book-20210109": {
"uuid": "RsGez7_5G171lS_tKtQyDw",
"primaries": {
"search": {
"open_contexts": 0,
"query_total": 700,
"query_time_in_millis": 2054,
"query_current": 0,
"fetch_total": 0,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 1,
"scroll_time_in_millis": 117920,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
}
},
"total": {
"search": {
"open_contexts": 0,
"query_total": 1399,
"query_time_in_millis": 4168,
"query_current": 0,
"fetch_total": 0,
"fetch_time_in_millis": 0,
"fetch_current": 0,
"scroll_total": 1,
"scroll_time_in_millis": 117920,
"scroll_current": 0,
"suggest_total": 0,
"suggest_time_in_millis": 0,
"suggest_current": 0
}
}
},
...
}
}
6、search - segments - 段的内存使用情况
段的内存使用情况。
//获取所有索引的segments信息
GET /_stats/segments
//获取所有索引的segments信息
GET /bank/_stats/segments
//获取同类索引的segments信息
GET /log-*/_stats/segments
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"segments": {
// 该索引目前拥有的总段数
"count": 169,
// 该索引缓存在内存中字节数
"memory_in_bytes": 4404644,
// 倒排索引(term)缓存在内中所占字节数
"terms_memory_in_bytes": 3723502,
// 该索引定义为stored_fields字段在内存中缓存的字节数
"stored_fields_memory_in_bytes": 574016,
// 该索引term_vectors(词向量)在内存中所占字节数量
"term_vectors_memory_in_bytes": 0,
// 该索引存储对应norms=true的字段当前在内存中缓存字节数
"norms_memory_in_bytes": 10816,
// 与地理位置相关的缓存数据
"points_memory_in_bytes": 67946,
// 设置为doc_values缓存在内存中的字节数(doc_values,列式存储)
"doc_values_memory_in_bytes": 28364,
// 用于优化索引写的缓存(减少写磁盘的频率
"index_writer_memory_in_bytes": 768320,
// 关于文档的版本映射所占内存大小
"version_map_memory_in_bytes": 0,
// fixed_bit_set内存,专门用来做nested查询的
"fixed_bit_set_memory_in_bytes": 0,
// es内部当前的自增ID
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {
}
}
},
"total": {
"segments": {
"count": 330,
"memory_in_bytes": 8775500,
"terms_memory_in_bytes": 7417480,
"stored_fields_memory_in_bytes": 1147528,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 21120,
"points_memory_in_bytes": 136188,
"doc_values_memory_in_bytes": 53184,
"index_writer_memory_in_bytes": 768320,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {
}
}
}
},
"indices": {
"book-20210120": {
"uuid": "k43l2I4T2hCVYxgmvFb2Dy",
"primaries": {
"segments": {
"count": 8,
"memory_in_bytes": 247039,
"terms_memory_in_bytes": 209657,
"stored_fields_memory_in_bytes": 32272,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 512,
"points_memory_in_bytes": 3998,
"doc_values_memory_in_bytes": 600,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {
}
}
},
"total": {
"segments": {
"count": 17,
"memory_in_bytes": 499726,
"terms_memory_in_bytes": 422271,
"stored_fields_memory_in_bytes": 65088,
"term_vectors_memory_in_bytes": 0,
"norms_memory_in_bytes": 1088,
"points_memory_in_bytes": 8011,
"doc_values_memory_in_bytes": 3268,
"index_writer_memory_in_bytes": 0,
"version_map_memory_in_bytes": 0,
"fixed_bit_set_memory_in_bytes": 0,
"max_unsafe_auto_id_timestamp": -1,
"file_sizes": {
}
}
}
},
...
}
}
7、completion - 自动提示统计信息
自动提示统计信息。
//获取所有索引的completion信息
GET /_stats/completion
//获取所有索引的completion信息
GET /bank/_stats/completion
//获取同类索引的completion信息
GET /log-*/_stats/completion
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"completion": {
// 自动提示占用字节数
"size_in_bytes": 0
}
},
"total": {
"completion": {
"size_in_bytes": 0
}
}
},
"indices": {
"book-20210120": {
"uuid": "vFb22k4Thm43l2IDyCVYxg",
"primaries": {
"completion": {
"size_in_bytes": 0
}
},
"total": {
"completion": {
"size_in_bytes": 0
}
}
},
...
}
}
8、fielddata - 统计信息
fielddata统计信息,fielddata主要用加快text字段排序与聚合的性能,存储词根与文档的映射关系存储在在内存,在内存中进行排序与聚合。
//获取所有索引的fielddata信息
GET /_stats/fielddata
//获取所有索引的fielddata信息
GET /bank/_stats/fielddata
//获取同类索引的fielddata信息
GET /log-*/_stats/fielddata
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"fielddata": {
// 当前占用内存的大小
"memory_size_in_bytes": 5488,
// 被逐出词根的个数
"evictions": 0
}
},
"total": {
"fielddata": {
"memory_size_in_bytes": 9688,
"evictions": 0
}
}
},
"indices": {
"book-20210130": {
"uuid": "VYxI4Th2kC43l2mvFb2Dyg",
"primaries": {
"fielddata": {
"memory_size_in_bytes": 928,
"evictions": 0
}
},
"total": {
"fielddata": {
"memory_size_in_bytes": 1376,
"evictions": 0
}
}
},
...
}
}
9、flush - 刷新到磁盘的统计信息
将es数据flush到磁盘的统计信息。
//获取所有索引的flush信息
GET /_stats/flush
//获取所有索引的flush信息
GET /bank/_stats/flush
//获取同类索引的flush信息
GET /log-*/_stats/flush
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"flush": {
// 刷新数据到磁盘的次数
"total": 16,
// 当translog超过刷新阈值时周期性触发的刷新次数
"periodic": 0,
// 总耗时
"total_time_in_millis": 1640
}
},
"total": {
"flush": {
"total": 33,
"periodic": 0,
"total_time_in_millis": 2953
}
}
},
"indices": {
"book-20210131": {
"uuid": "mvFyCb22k4I4ThDVY3l2xg",
"primaries": {
"flush": {
"total": 1,
"periodic": 0,
"total_time_in_millis": 443
}
},
"total": {
"flush": {
"total": 2,
"periodic": 0,
"total_time_in_millis": 459
}
}
},
...
}
}
10、merge - 合并统计信息
合并统计信息。
//获取所有索引的merge信息
GET /_stats/merge
//获取所有索引的merge信息
GET /bank/_stats/merge
//获取同类索引的merge信息
GET /log-*/_stats/merge
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"merges": {
// 当前发生的合并次数
"current": 0,
// 当前正在发生合并的文档数
"current_docs": 0,
// 当前合并参与的文档总大小,单位字节
"current_size_in_bytes": 0,
// 总发生的合并次数
"total": 18074,
// 合并的总耗时(单位毫秒)
"total_time_in_millis": 2267867,
// merge(合并)时总处理的文档个数
"total_docs": 125994477,
// merge(合并)时总处理的文档总大小(字节)
"total_size_in_bytes": 53807733094,
// merge(合并)时总停止时间(吞吐率为0)
"total_stopped_time_in_millis": 0,
// 超过指定吞吐率而暂停的时间(节流)
"total_throttled_time_in_millis": 28682,
// 自动进行流控的阔值,默认速率20m/s
"total_auto_throttle_in_bytes": 309026610
}
},
"total": {
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 37362,
"total_time_in_millis": 4776771,
"total_docs": 258338766,
"total_size_in_bytes": 110130214943,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 57781,
"total_auto_throttle_in_bytes": 618053220
}
}
},
"indices": {
"book-20210201": {
"uuid": "hT2DymvFl2I4CVb2k43Yxg",
"primaries": {
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 1224,
"total_time_in_millis": 147690,
"total_docs": 8924693,
"total_size_in_bytes": 3754681042,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 2058,
"total_auto_throttle_in_bytes": 19065018
}
},
"total": {
"merges": {
"current": 0,
"current_docs": 0,
"current_size_in_bytes": 0,
"total": 2446,
"total_time_in_millis": 320220,
"total_docs": 17270022,
"total_size_in_bytes": 7223483338,
"total_stopped_time_in_millis": 0,
"total_throttled_time_in_millis": 4098,
"total_auto_throttle_in_bytes": 38130036
}
}
},
...
}
}
11、refresh - 统计信息
refresh统计信息。
//获取所有索引的refresh信息
GET /_stats/refresh
//获取所有索引的refresh信息
GET /bank/_stats/refresh
//获取同类索引的refresh信息
GET /log-*/_stats/refresh
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"refresh": {
// 执行刷新的总次数
"total": 168484,
// 总耗时
"total_time_in_millis": 1514449,
// 等待刷新侦听器的数量
"listeners": 0
}
},
"total": {
"refresh": {
"total": 348465,
"total_time_in_millis": 3154142,
"listeners": 0
}
}
},
"indices": {
"book-20210202": {
"uuid": "4Thhg!2_2k4msdfgd3l2IvFb2DyCVYxg",
"primaries": {
"refresh": {
"total": 11448,
"total_time_in_millis": 92157,
"listeners": 0
}
},
"total": {
"refresh": {
"total": 22887,
"total_time_in_millis": 213867,
"listeners": 0
}
}
},
...
}
}
12、request_cache - 统计信息
request_cache统计信息。
//获取所有索引的request_cache信息
GET /_stats/request_cache
//获取所有索引的request_cache信息
GET /bank/_stats/request_cache
//获取同类索引的request_cache信息
GET /log-*/_stats/request_cache
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"request_cache": {
// 请求缓存占用内存总大小
"memory_size_in_bytes": 1062768,
// 请求缓存被剔除出次数
"evictions": 0,
// 请求缓存被命中次数
"hit_count": 4996,
// 请求缓存未命中次数
"miss_count": 2237
}
},
"total": {
"request_cache": {
"memory_size_in_bytes": 2130030,
"evictions": 0,
"hit_count": 10128,
"miss_count": 4579
}
}
},
"indices": {
"book-20210204": {
"uuid": "b2Dy2k44Thl2IxgmvFCVY3",
"primaries": {
"request_cache": {
"memory_size_in_bytes": 74731,
"evictions": 0,
"hit_count": 379,
"miss_count": 130
}
},
"total": {
"request_cache": {
"memory_size_in_bytes": 149462,
"evictions": 0,
"hit_count": 756,
"miss_count": 260
}
}
},
...
}
}
13、warmer - 分片预热统计信息
分片预热统计信息。
//获取所有索引的warmer信息
GET /_stats/warmer
//获取所有索引的warmer信息
GET /bank/_stats/warmer
//获取同类索引的warmer信息
GET /log-*/_stats/warmer
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"warmer": {
// 当前正在预热的个数
"current": 0,
// 总共发生的预热次数
"total": 168464,
// 分片预热总耗时
"total_time_in_millis": 2544
}
},
"total": {
"warmer": {
"current": 0,
"total": 348428,
"total_time_in_millis": 5139
}
}
},
"indices": {
"book-20210204": {
"uuid": "2l2I_2Dy38fjd94_Yxg",
"primaries": {
"warmer": {
"current": 0,
"total": 11445,
"total_time_in_millis": 161
}
},
"total": {
"warmer": {
"current": 0,
"total": 22881,
"total_time_in_millis": 364
}
}
},
...
}
}
14、translog - 统计信息
translog的统计信息。
//获取所有索引的translog信息
GET /_stats/translog
//获取所有索引的translog信息
GET /bank/_stats/translog
//获取同类索引的translog信息
GET /log-*/_stats/translog
返回:
{
"_shards": {
"total": 32,
"successful": 32,
"failed": 0
},
"_all": {
"primaries": {
"translog": {
// 写translog的次数(索引文档、更新文档、删除文档的总操作数量)
"operations": 240497,
// translog实例管理的translog文件总大小。(一个索引引擎(InternalEngine)示例包含一个Translog实例)
"size_in_bytes": 215617938,
// 当前还未提交到lucene中的操作次数(索引文档、更新文档、删除文档的操作数量)
"uncommitted_operations": 240497,
// translog中未提交到Lucene中的字节数
"uncommitted_size_in_bytes": 215617938,
// 以秒为单位返回translog文件中最老条目的年龄
"earliest_last_modified_age": 0
}
},
"total": {
"translog": {
"operations": 480994,
"size_in_bytes": 431235821,
"uncommitted_operations": 480994,
"uncommitted_size_in_bytes": 431235821,
"earliest_last_modified_age": 0
}
}
},
"indices": {
"book-20210206": {
"uuid": "s728d00f_s8",
"primaries": {
"translog": {
"operations": 0,
"size_in_bytes": 55,
"uncommitted_operations": 0,
"uncommitted_size_in_bytes": 55,
"earliest_last_modified_age": 0
}
},
"total": {
"translog": {
"operations": 0,
"size_in_bytes": 110,
"uncommitted_operations": 0,
"uncommitted_size_in_bytes": 110,
"earliest_last_modified_age": 0
}
}
},
...
}
}
15、recovery - 恢复的统计信息
恢复的统计信息。
//获取所有索引的recovery信息
GET /_stats/recovery
//获取所有索引的recovery信息
GET /bank/_stats/recovery
//获取同类索引的recovery信息
GET /log-*/_stats/recovery
返回:
{
"_shards": {
"total": 34,
"successful": 34,
"failed": 0
},
"_all": {
"primaries": {
"recovery": {
// 作为源分片,正在执行恢复的分片数量
"current_as_source": 0,
// 作为目标分片,正在执行恢复的分片数量
"current_as_target": 0,
// 恢复过程总等待时间
"throttle_time_in_millis": 36
}
},
"total": {
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 36
}
}
},
"indices": {
"book-20210206": {
"uuid": "06hsdygt9ZXT1T245L_4uiw",
"primaries": {
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
},
"total": {
"recovery": {
"current_as_source": 0,
"current_as_target": 0,
"throttle_time_in_millis": 0
}
}
},
...
}
}