Elasticsearch 基础教程

Elasticsearch 高级教程

Elasticsearch 插件

Elasticsearch 笔记

Elasticsearch FAQ

original icon
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.knowledgedict.com/tutorial/elasticsearch-cat-indices-get.html

Elasticsearch(es)查看集群所有索引情况

Elasticsearch(es)如何监控集群及查看哪些核心指标 Elasticsearch(es)如何监控集群及查看哪些核心指标


Elasticsearch(es)查看集群中所有索引情况可以使用 cat API 查看,其中索引相关的接口是 _cat/indices

几种方式

可以在终端执行 curl 命令或在 es 工具上执行 get 请求(如 kibana 的 dev tools)。

curl 命令

curl -XGET 'localhost:9200/_cat/indices?v&pretty'

Kibana Dev Tools 上执行

GET _cat/indices?v&s=index:asc

其中参数 v 全称是 verbose,表示返回详细的输出;s 参数表示进行排序(sort),形式 s=column1,column2:<desc/asc>

返回信息如下:

health status index                          uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   .apm-agent-configuration       66BPyWWQTQyOObMzsapHog   1   1          0            0       416b           208b
green  open   .apm-custom-link               vUQ5vzCZTQmpKBGSCcbSPA   1   1          0            0       416b           208b
green  open   .kibana-event-log-7.9.1-000001 TbbmMYxBTceGYvJpdMNy3Q   1   1          1            0     11.1kb          5.5kb
green  open   .kibana_1                      KX4TF1r0T16eyG02qP3gCw   1   1       1041            3       21mb         10.5mb
green  open   .kibana_task_manager_1         DGckKZ-BTYOAGaq6-QFU2A   1   1          6        38095     39.6mb         19.8mb
green  open   qa                             jCHwgQn0QX2tM2dA9dJi8w   8   2     211572           53      3.3gb          1.1gb
......

返回信息的第一行对应的每一列字段意义如下:

health
当前健康状态
status
开启/关闭(open/close)状态
index
索引名称
uuid
索引 uuid
pri
主分片数目
rep
副本分片数目
docs.count
可用的文档数目
docs.deleted
已删除的文档数目
store.size
主分片和副本分片的存储文档空间大小
pri.store.size
主分片的存储文档空间大小

关于列字段的更多内容,也可以通过增加 help 参数进行查看。

GET _cat/indices?help

输出如下:

health                           | h                              | current health status                                                                                            
status                           | s                              | open/close status                                                                                                
index                            | i,idx                          | index name                                                                                                       
uuid                             | id,uuid                        | index uuid                                                                                                       
pri                              | p,shards.primary,shardsPrimary | number of primary shards                                                                                         
rep                              | r,shards.replica,shardsReplica | number of replica shards                                                                                         
docs.count                       | dc,docsCount                   | available docs                                                                                                   
docs.deleted                     | dd,docsDeleted                 | deleted docs                                                                                                     
creation.date                    | cd                             | index creation date (millisecond value)                                                                          
creation.date.string             | cds                            | index creation date (as string)                                                                                  
store.size                       | ss,storeSize                   | store size of primaries & replicas                                                                               
pri.store.size                   |                                | store size of primaries                                                                                          
completion.size                  | cs,completionSize              | size of completion                                                                                               
pri.completion.size              |                                | size of completion                                                                                               
fielddata.memory_size            | fm,fielddataMemory             | used fielddata cache                                                                                             
pri.fielddata.memory_size        |                                | used fielddata cache                                                                                             
fielddata.evictions              | fe,fielddataEvictions          | fielddata evictions                                                                                              
pri.fielddata.evictions          |                                | fielddata evictions                                                                                              
query_cache.memory_size          | qcm,queryCacheMemory           | used query cache                                                                                                 
pri.query_cache.memory_size      |                                | used query cache                                                                                                 
query_cache.evictions            | qce,queryCacheEvictions        | query cache evictions                                                                                            
pri.query_cache.evictions        |                                | query cache evictions                                                                                            
request_cache.memory_size        | rcm,requestCacheMemory         | used request cache                                                                                               
pri.request_cache.memory_size    |                                | used request cache                                                                                               
request_cache.evictions          | rce,requestCacheEvictions      | request cache evictions                                                                                          
pri.request_cache.evictions      |                                | request cache evictions                                                                                          
request_cache.hit_count          | rchc,requestCacheHitCount      | request cache hit count                                                                                          
pri.request_cache.hit_count      |                                | request cache hit count                                                                                          
request_cache.miss_count         | rcmc,requestCacheMissCount     | request cache miss count                                                                                         
pri.request_cache.miss_count     |                                | request cache miss count                                                                                         
flush.total                      | ft,flushTotal                  | number of flushes                                                                                                
pri.flush.total                  |                                | number of flushes                                                                                                
flush.total_time                 | ftt,flushTotalTime             | time spent in flush                                                                                              
pri.flush.total_time             |                                | time spent in flush                                                                                              
get.current                      | gc,getCurrent                  | number of current get ops                                                                                        
pri.get.current                  |                                | number of current get ops                                                                                        
get.time                         | gti,getTime                    | time spent in get                                                                                                
pri.get.time                     |                                | time spent in get                                                                                                
get.total                        | gto,getTotal                   | number of get ops                                                                                                
pri.get.total                    |                                | number of get ops                                                                                                
get.exists_time                  | geti,getExistsTime             | time spent in successful gets                                                                                    
pri.get.exists_time              |                                | time spent in successful gets                                                                                    
get.exists_total                 | geto,getExistsTotal            | number of successful gets                                                                                        
pri.get.exists_total             |                                | number of successful gets                                                                                        
get.missing_time                 | gmti,getMissingTime            | time spent in failed gets                                                                                        
pri.get.missing_time             |                                | time spent in failed gets                                                                                        
get.missing_total                | gmto,getMissingTotal           | number of failed gets                                                                                            
pri.get.missing_total            |                                | number of failed gets                                                                                            
indexing.delete_current          | idc,indexingDeleteCurrent      | number of current deletions                                                                                      
pri.indexing.delete_current      |                                | number of current deletions                                                                                      
indexing.delete_time             | idti,indexingDeleteTime        | time spent in deletions                                                                                          
pri.indexing.delete_time         |                                | time spent in deletions                                                                                          
indexing.delete_total            | idto,indexingDeleteTotal       | number of delete ops                                                                                             
pri.indexing.delete_total        |                                | number of delete ops                                                                                             
indexing.index_current           | iic,indexingIndexCurrent       | number of current indexing ops                                                                                   
pri.indexing.index_current       |                                | number of current indexing ops                                                                                   
indexing.index_time              | iiti,indexingIndexTime         | time spent in indexing                                                                                           
pri.indexing.index_time          |                                | time spent in indexing                                                                                           
indexing.index_total             | iito,indexingIndexTotal        | number of indexing ops                                                                                           
pri.indexing.index_total         |                                | number of indexing ops                                                                                           
indexing.index_failed            | iif,indexingIndexFailed        | number of failed indexing ops                                                                                    
pri.indexing.index_failed        |                                | number of failed indexing ops                                                                                    
merges.current                   | mc,mergesCurrent               | number of current merges                                                                                         
pri.merges.current               |                                | number of current merges                                                                                         
merges.current_docs              | mcd,mergesCurrentDocs          | number of current merging docs                                                                                   
pri.merges.current_docs          |                                | number of current merging docs                                                                                   
merges.current_size              | mcs,mergesCurrentSize          | size of current merges                                                                                           
pri.merges.current_size          |                                | size of current merges                                                                                           
merges.total                     | mt,mergesTotal                 | number of completed merge ops                                                                                    
pri.merges.total                 |                                | number of completed merge ops                                                                                    
merges.total_docs                | mtd,mergesTotalDocs            | docs merged                                                                                                      
pri.merges.total_docs            |                                | docs merged                                                                                                      
merges.total_size                | mts,mergesTotalSize            | size merged                                                                                                      
pri.merges.total_size            |                                | size merged                                                                                                      
merges.total_time                | mtt,mergesTotalTime            | time spent in merges                                                                                             
pri.merges.total_time            |                                | time spent in merges                                                                                             
refresh.total                    | rto,refreshTotal               | total refreshes                                                                                                  
pri.refresh.total                |                                | total refreshes                                                                                                  
refresh.time                     | rti,refreshTime                | time spent in refreshes                                                                                          
pri.refresh.time                 |                                | time spent in refreshes                                                                                          
refresh.listeners                | rli,refreshListeners           | number of pending refresh listeners                                                                              
pri.refresh.listeners            |                                | number of pending refresh listeners                                                                              
search.fetch_current             | sfc,searchFetchCurrent         | current fetch phase ops                                                                                          
pri.search.fetch_current         |                                | current fetch phase ops                                                                                          
search.fetch_time                | sfti,searchFetchTime           | time spent in fetch phase                                                                                        
pri.search.fetch_time            |                                | time spent in fetch phase                                                                                        
search.fetch_total               | sfto,searchFetchTotal          | total fetch ops                                                                                                  
pri.search.fetch_total           |                                | total fetch ops                                                                                                  
search.open_contexts             | so,searchOpenContexts          | open search contexts                                                                                             
pri.search.open_contexts         |                                | open search contexts                                                                                             
search.query_current             | sqc,searchQueryCurrent         | current query phase ops                                                                                          
pri.search.query_current         |                                | current query phase ops                                                                                          
search.query_time                | sqti,searchQueryTime           | time spent in query phase                                                                                        
pri.search.query_time            |                                | time spent in query phase                                                                                        
search.query_total               | sqto,searchQueryTotal          | total query phase ops                                                                                            
pri.search.query_total           |                                | total query phase ops                                                                                            
search.scroll_current            | scc,searchScrollCurrent        | open scroll contexts                                                                                             
pri.search.scroll_current        |                                | open scroll contexts                                                                                             
search.scroll_time               | scti,searchScrollTime          | time scroll contexts held open                                                                                   
pri.search.scroll_time           |                                | time scroll contexts held open                                                                                   
search.scroll_total              | scto,searchScrollTotal         | completed scroll contexts                                                                                        
pri.search.scroll_total          |                                | completed scroll contexts                                                                                        
segments.count                   | sc,segmentsCount               | number of segments                                                                                               
pri.segments.count               |                                | number of segments                                                                                               
segments.memory                  | sm,segmentsMemory              | memory used by segments                                                                                          
pri.segments.memory              |                                | memory used by segments                                                                                          
segments.index_writer_memory     | siwm,segmentsIndexWriterMemory | memory used by index writer                                                                                      
pri.segments.index_writer_memory |                                | memory used by index writer                                                                                      
segments.version_map_memory      | svmm,segmentsVersionMapMemory  | memory used by version map                                                                                       
pri.segments.version_map_memory  |                                | memory used by version map                                                                                       
segments.fixed_bitset_memory     | sfbm,fixedBitsetMemory         | memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields
pri.segments.fixed_bitset_memory |                                | memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields
warmer.current                   | wc,warmerCurrent               | current warmer ops                                                                                               
pri.warmer.current               |                                | current warmer ops                                                                                               
warmer.total                     | wto,warmerTotal                | total warmer ops                                                                                                 
pri.warmer.total                 |                                | total warmer ops                                                                                                 
warmer.total_time                | wtt,warmerTotalTime            | time spent in warmers                                                                                            
pri.warmer.total_time            |                                | time spent in warmers                                                                                            
suggest.current                  | suc,suggestCurrent             | number of current suggest ops                                                                                    
pri.suggest.current              |                                | number of current suggest ops                                                                                    
suggest.time                     | suti,suggestTime               | time spend in suggest                                                                                            
pri.suggest.time                 |                                | time spend in suggest                                                                                            
suggest.total                    | suto,suggestTotal              | number of suggest ops                                                                                            
pri.suggest.total                |                                | number of suggest ops                                                                                            
memory.total                     | tm,memoryTotal                 | total used memory                                                                                                
pri.memory.total                 |                                | total user memory                                   

 

使用`curl`命令可以通过发送HTTP请求来与Elasticsearch进行交互。要查看Elasticsearch中的所有索引,可以发送一 ...
elasticsearch 删除索引操作能够用单个命令来进行完成,有不同的操作形式,具体如下: ...
Elasticsearch 创建索引如同 MySQL 创建数据库,es 提供了 RESTFul API 来创建索引,可以通过 PUT 命令快 ...
Elasticsearch索引管理主要包括如何进行索引的创建、索引的删除、副本的更新、索引读写权限、索引别名的配置等等内容。首先,创建索引m ...
以下是在Elasticsearch中查询所有索引的不同实现方式,每种方式都附有示例代码和解释。示例代码:解释:CatIndicesAPI返回 ...