# Doc\_values disk usage

**URL:** <https://discuss.elastic.co/t/doc-values-disk-usage/94830>\
**Category:** Elasticsearch\
**Created:** [July 27, 2017, 3:50pm UTC](https://discuss.elastic.co/t/doc-values-disk-usage/94830 "2017-07-27T15:50:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ananth](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ananth](https://discuss.elastic.co/u/ananth)\
**Post date:** [July 27, 2017, 3:50pm UTC](https://discuss.elastic.co/t/doc-values-disk-usage/94830/1 "2017-07-27T15:50:15Z")

</div>

[[https://www.elastic.co/guide/en/elasticsearch/guide/current/\_deep\_dive\_on\_doc\_values.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/_deep_dive_on_doc_values.html)]

From the above link (In general) number fields doc\_value will use less disk compare with string fields doc\_values. I tried a simple test for the same but the results were vice versa. Please refer the below steps. (I tried in both 2.3.2 and 5.4.1)

I created two indices namely str\_index & int\_index.

str\_index have 5 keyword fields (with field mapping{"norms":false,"index":"not\_analyzed","type”:”keyword”,”doc\_values":true})

int\_index have 5 integer fields (with field mapping{“type”:”integer”,”doc\_values":true})

Refer the following code snippet

public static void indexTestData()  
{  
int fieldCardinality = 5000;  
int numDocsToBeIndexed = 10000000; //10 million  
for(int i=0;i\<numDocToBeIndexed;i++)  
{  
JSONObject strIndexDoc = getDocumentJson(i,fieldCardinality,true);  
JSONObject intIndexDoc = getDocumentJson(i,fieldCardinality,false); // Did Bulk indexing on every 1000 docs.  
}

}

public static JSONObject getDocumentJson(int docnumber, int fieldCardinality, boolean strField)  
{  
int value = docnumber % fieldCardinality;  
JSONObject json = new JSONObject();  
json.put("f1", strField ? "This is field1 doc value" + value : value);  
json.put("f2", strField ? "This is field2 doc value" + value : value);  
json.put("f3", strField ? "This is field3 doc value" + value : value);  
json.put("f4", strField ? "This is field4 doc value" + value : value);  
json.put("f5", strField ? "This is field5 doc value" + value : value);  
return json;  
}

The results are str\_index size is 320.2mb and int\_index size is 373.5mb.

Any ideas ?

---

<div class="post-metadata">

**Author:** ![ananth](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ananth](https://discuss.elastic.co/u/ananth)\
**Post date:** [August 1, 2017, 6:39am UTC](https://discuss.elastic.co/t/doc-values-disk-usage/94830/2 "2017-08-01T06:39:46Z")

</div>

any idea ? @Adrein Grand

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 29, 2017, 6:39am UTC](https://discuss.elastic.co/t/doc-values-disk-usage/94830/3 "2017-08-29T06:39:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
