Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch find disk space usage

How can I find the amount of disk space that Elastic Search is using for my indexes? I'm currently running it locally and I'm trying to see how much disk space I will need on the VM that I'll be spinning up.

like image 567
Nived Avatar asked Apr 02 '15 16:04

Nived


People also ask

How do I free up disk space in Elasticsearch?

For this the best thing to do is to create a new index every day and them after 7 days. It is very very inefficient to 1/7 of and index every day. If you delete the index that should give you the space back within a few seconds.


2 Answers

The Elasticsearch way to do this would be to use _cat/shards and look at the store column:

curl -XGET "http://localhost:9200/_cat/shards?v"  index              shard prirep state     docs   store ip            node myindex_2014_12_19 2     r      STARTED  76661 415.6mb 192.168.1.1 Georgianna Castleberry myindex_2014_12_19 2     p      STARTED  76661 417.3mb 192.168.1.2 Frederick Slade myindex_2014_12_19 2     r      STARTED  76661 416.9mb 192.168.1.3 Maverick myindex_2014_12_19 0     r      STARTED  76984 525.9mb 192.168.1.1 Georgianna Castleberry myindex_2014_12_19 0     r      STARTED  76984   527mb 192.168.1.2 Frederick Slade myindex_2014_12_19 0     p      STARTED  76984   526mb 192.168.1.3 Maverick myindex_2014_12_19 3     r      STARTED    163 208.5kb 192.168.1.1 Georgianna Castleberry myindex_2014_12_19 3     p      STARTED    163 191.4kb 192.168.1.2 Frederick Slade myindex_2014_12_19 3     r      STARTED    163 181.6kb 192.168.1.3 Maverick myindex_2014_12_19 1     p      STARTED 424923   2.1gb 192.168.1.1 Georgianna Castleberry myindex_2014_12_19 1     r      STARTED 424923   2.1gb 192.168.1.2 Frederick Slade myindex_2014_12_19 1     r      STARTED 424923   2.1gb 192.168.1.3 Maverick myindex_2014_12_19 4     r      STARTED  81020 435.9mb 192.168.1.1 Georgianna Castleberry myindex_2014_12_19 4     p      STARTED  81020 437.8mb 192.168.1.2 Frederick Slade myindex_2014_12_19 4     r      STARTED  81020 437.8mb 192.168.1.3 Maverick 

Otherwise in Linux to view the space by folder use:

du -hs /myelasticsearch/data/folder 

or to view the space by filesystem:

df -h  
like image 174
Olly Cruickshank Avatar answered Nov 15 '22 19:11

Olly Cruickshank


In case you don't need per-shard statistics returned by /_cat/shards you can use

curl -XGET 'http://localhost:9200/_cat/allocation?v' 

to get used and available disk space for each node.

like image 20
marat Avatar answered Nov 15 '22 19:11

marat