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.


Solution 1:

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 

Solution 2:

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.