# Reduce size of index which contains integer fields only

**URL:** <https://discuss.elastic.co/t/reduce-size-of-index-which-contains-integer-fields-only/26963>\
**Category:** Elasticsearch\
**Created:** [August 6, 2015, 10:56am UTC](https://discuss.elastic.co/t/reduce-size-of-index-which-contains-integer-fields-only/26963 "2015-08-06T10:56:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pinokio](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pinokio](https://discuss.elastic.co/u/pinokio)\
**Post date:** [August 6, 2015, 10:56am UTC](https://discuss.elastic.co/t/reduce-size-of-index-which-contains-integer-fields-only/26963/1 "2015-08-06T10:56:22Z")

</div>

Hi,  
I am trying to create an index from integer fields only, like that  
{  
"type" : 2,  
"cat\_id": 1,  
"value": 12.22,  
"date" : "2015-01-01T00:00:00"  
}  
Does anyone experience the similar circumstance, please give give me advice on choosing appropriate mapping, to reduce index size as much as possible.  
Here is mine, plz review  
PUT /data  
{  
"settings" : {  
"index" : {  
"number\_of\_shards" : 10,  
"number\_of\_replicas" : 0,  
"store.compress.stored": true  
}  
},  
"mappings": {  
"ds":{  
"\_source" : { "enabled" : false },  
"\_all" : { "enabled" : false },  
"properties" : {  
"cat\_id" : { "type" : "integer", "index" : "not\_analyzed", "precision\_step": 4096, "doc\_values": true},  
"type" : { "type" : "integer", "index" : "not\_analyzed", "precision\_step": 4096, "doc\_values": true, "store": "yes" },  
"value" : { "type" : "float", "index" : "not\_analyzed", "precision\_step": 4096, "store": "yes", "fielddata": {"loading": "eager"}},  
"date" : { "type": "date", "index": "not\_analyzed", "precision\_step": 4096, "format": "YYYY-MM-dd HH:mm:ss", "doc\_values": true}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 7, 2015, 8:07am UTC](https://discuss.elastic.co/t/reduce-size-of-index-which-contains-integer-fields-only/26963/2 "2015-08-07T08:07:25Z")

</div>

That looks pretty good to me, what problems do you have with it?

Also you should really store that date in UTC 🙂

---

<div class="post-metadata">

**Author:** ![pinokio](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pinokio](https://discuss.elastic.co/u/pinokio)\
**Post date:** [August 7, 2015, 9:28am UTC](https://discuss.elastic.co/t/reduce-size-of-index-which-contains-integer-fields-only/26963/3 "2015-08-07T09:28:49Z")

</div>

I just want to reduce the index size as much as possible. Maybe there are some tricks out there that I didn't know. Hence this topic 😄

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [August 7, 2015, 10:12am UTC](https://discuss.elastic.co/t/reduce-size-of-index-which-contains-integer-fields-only/26963/4 "2015-08-07T10:12:46Z")

</div>

There are trade offs here though. For example, setting the precision step to 4096 will mean that range searches will not be as efficient in terms of response time. Also I don't think you will save much space by disabling \_source and setting `store: yes` on most of the fields. It may well be better to use the \_source field.

Also, you should test each of these settings on your use case. You may fine some of them are not decreasing disk usage as much as you think or may in fact be increasing the disk usage (e.g. because the compression is not as efficient on separate stored fields compared with the \_source field.

---

<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:** [July 5, 2017, 11:56pm UTC](https://discuss.elastic.co/t/reduce-size-of-index-which-contains-integer-fields-only/26963/5 "2017-07-05T23:56:50Z")

</div>


