Saturday 21 November 2015

Elastic search : cat api: statistics in tabular format

Cat api provides statistics in tabular format.

GET _cat
Above statement displays all the available options for cat api. Response like below.

=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_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/plugins
/_cat/fielddata
/_cat/fielddata/{fields}

1.To get shards information
GET _cat/shards


Response like below.
books              4 p STARTED       0   115b 172.16.0.3 sample_node 
books              4 r UNASSIGNED                                    
books              0 p STARTED       0   115b 172.16.0.3 sample_node 
books              0 r UNASSIGNED                                    
books              3 p STARTED       1  2.5kb 172.16.0.3 sample_node 
books              3 r UNASSIGNED                                    
books              1 p STARTED       0   115b 172.16.0.3 sample_node 
books              1 r UNASSIGNED                                    
books              2 p STARTED       1  2.5kb 172.16.0.3 sample_node 
books              2 r UNASSIGNED                                    
.marvel-2015.01.07 0 p STARTED    8922 26.2mb 172.16.0.3 sample_node 
.marvel-2015.01.07 0 r UNASSIGNED    
As you observe the response, it is in tabular format (not json) and it don’t have column headers.

To display column headers use ‘?v’ parameter.

GET _cat/shards?v

Response like below.

index              shard prirep state      docs  store ip         node        
books              4     p      STARTED       0   115b 172.16.0.3 sample_node 
books              4     r      UNASSIGNED                                    
books              0     p      STARTED       0   115b 172.16.0.3 sample_node 
books              0     r      UNASSIGNED                                    
books              3     p      STARTED       1  2.5kb 172.16.0.3 sample_node 
books              3     r      UNASSIGNED                                    
books              1     p      STARTED       0   115b 172.16.0.3 sample_node 
books              1     r      UNASSIGNED                                    
books              2     p      STARTED       1  2.5kb 172.16.0.3 sample_node 
books              2     r      UNASSIGNED                                    
.marvel-2015.01.07 0     p      STARTED    8957 27.2mb 172.16.0.3 sample_node 
.marvel-2015.01.07 0     r      UNASSIGNED                                    


2.To get cluster health
GET _cat/health?v

Response like below.

epoch      timestamp cluster        status node.total node.data shards pri relo init unassign 
1420630100 16:58:20  cluster_sample yellow          1         1      6   6    0    0        6


3. To get information about nodes.
GET _cat/nodes?v

Response like below.

host            ip         heap.percent ram.percent load node.role master name        
RENT-MIS-LT3016 172.16.0.3            4          60      d         *      sample_node


4. You can add help parameter at the end of cat endpoint to get more help on how to use this endpoint with more options.                               

GET _cat/nodes?help

Response like below.    
id                               | id,nodeId                          | unique node id                                                                                                   
pid                              | p                                  | process id                                                                                                       
host                             | h                                  | host name                                                                                                        
ip                               | i                                  | ip address                                                                                                       
port                             | po                                 | bound transport port                                                                                             
version                          | v                                  | es version                                                                                                       
build                            | b                                  | es build hash                                                                                                    
jdk                              | j                                  | jdk version                                                                                                      
disk.avail                       | d,disk,diskAvail                   | available disk space                                                                                             
heap.percent                     | hp,heapPercent                     | used heap ratio                                                                                                  
heap.max                         | hm,heapMax                         | max configured heap                                                                                              
ram.percent                      | rp,ramPercent                      | used machine memory ratio                                                                                        
ram.max                          | rm,ramMax                          | total machine memory                                                                                             
load                             | l                                  | most recent load avg                                                                                             
uptime                           | u                                  | node uptime                                                                                                      
node.role                        | r,role,dc,nodeRole                 | d:data node, c:client node                                                                                       
master                           | m                                  | m:master-eligible, *:current master                                                                              
name                             | n                                  | node name                                                                                                        
completion.size                  | cs,completionSize                  | size of completion                                                                                               
fielddata.memory_size            | fm,fielddataMemory                 | used fielddata cache                                                                                             
fielddata.evictions              | fe,fielddataEvictions              | fielddata evictions                                                                                              
filter_cache.memory_size         | fcm,filterCacheMemory              | used filter cache                                                                                                
filter_cache.evictions           | fce,filterCacheEvictions           | filter cache evictions                                                                                           
query_cache.memory_size          | qcm,queryCacheMemory               | used query cache                                                                                                 
query_cache.evictions            | qce,queryCacheEvictions            | query cache evictions                                                                                            
query_cache.hit_count            | qchc,queryCacheHitCount            | query cache hit counts                                                                                           
query_cache.miss_count           | qcmc,queryCacheMissCount           | query cache miss counts                                                                                          
flush.total                      | ft,flushTotal                      | number of flushes                                                                                                
flush.total_time                 | ftt,flushTotalTime                 | time spent in flush                                                                                              
get.current                      | gc,getCurrent                      | number of current get ops                                                                                        
get.time                         | gti,getTime                        | time spent in get                                                                                                
get.total                        | gto,getTotal                       | number of get ops                                                                                                
get.exists_time                  | geti,getExistsTime                 | time spent in successful gets                                                                                    
get.exists_total                 | geto,getExistsTotal                | number of successful gets                                                                                        
get.missing_time                 | gmti,getMissingTime                | time spent in failed gets                                                                                        
get.missing_total                | gmto,getMissingTotal               | number of failed gets                                                                                            
id_cache.memory_size             | im,idCacheMemory                   | used id cache                                                                                                    
indexing.delete_current          | idc,indexingDeleteCurrent          | number of current deletions                                                                                      
indexing.delete_time             | idti,indexingDeleteTime            | time spent in deletions                                                                                          
indexing.delete_total            | idto,indexingDeleteTotal           | number of delete ops                                                                                             
indexing.index_current           | iic,indexingIndexCurrent           | number of current indexing ops                                                                                   
indexing.index_time              | iiti,indexingIndexTime             | time spent in indexing                                                                                           
indexing.index_total             | iito,indexingIndexTotal            | number of indexing ops                                                                                           
merges.current                   | mc,mergesCurrent                   | number of current merges                                                                                         
merges.current_docs              | mcd,mergesCurrentDocs              | number of current merging docs                                                                                   
merges.current_size              | mcs,mergesCurrentSize              | size of current merges                                                                                           
merges.total                     | mt,mergesTotal                     | number of completed merge ops                                                                                    
merges.total_docs                | mtd,mergesTotalDocs                | docs merged                                                                                                      
merges.total_size                | mts,mergesTotalSize                | size merged                                                                                                      
merges.total_time                | mtt,mergesTotalTime                | time spent in merges                                                                                             
percolate.current                | pc,percolateCurrent                | number of current percolations                                                                                   
percolate.memory_size            | pm,percolateMemory                 | memory used by percolations                                                                                      
percolate.queries                | pq,percolateQueries                | number of registered percolation queries                                                                         
percolate.time                   | pti,percolateTime                  | time spent percolating                                                                                           
percolate.total                  | pto,percolateTotal                 | total percolations                                                                                               
refresh.total                    | rto,refreshTotal                   | total refreshes                                                                                                  
refresh.time                     | rti,refreshTime                    | time spent in refreshes                                                                                          
search.fetch_current             | sfc,searchFetchCurrent             | current fetch phase ops                                                                                          
search.fetch_time                | sfti,searchFetchTime               | time spent in fetch phase                                                                                        
search.fetch_total               | sfto,searchFetchTotal              | total fetch ops                                                                                                  
search.open_contexts             | so,searchOpenContexts              | open search contexts                                                                                             
search.query_current             | sqc,searchQueryCurrent             | current query phase ops                                                                                          
search.query_time                | sqti,searchQueryTime               | time spent in query phase                                                                                        
search.query_total               | sqto,searchQueryTotal              | total query phase ops                                                                                            
segments.count                   | sc,segmentsCount                   | number of segments                                                                                               
segments.memory                  | sm,segmentsMemory                  | memory used by segments                                                                                          
segments.index_writer_memory     | siwm,segmentsIndexWriterMemory     | memory used by index writer                                                                                      
segments.index_writer_max_memory | siwmx,segmentsIndexWriterMaxMemory | maximum memory index writer may use before it must write buffered documents to a new segment                     
segments.version_map_memory      | svmm,segmentsVersionMapMemory      | 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
suggest.current                  | suc,suggestCurrent                 | number of current suggest ops                                                                                    
suggest.time                     | suti,suggestTime                   | time spend in suggest                                                                                            
suggest.total                    | suto,suggestTotal                  | number of suggest ops                                                                                            





Prevoius                                                 Next                                                 Home

No comments:

Post a Comment