# Index size

**URL:** <https://discuss.elastic.co/t/index-size/6378>\
**Category:** Elasticsearch\
**Created:** [January 13, 2012, 9:37pm UTC](https://discuss.elastic.co/t/index-size/6378 "2012-01-13T21:37:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [January 13, 2012, 9:37pm UTC](https://discuss.elastic.co/t/index-size/6378/1 "2012-01-13T21:37:42Z")

</div>

Hi,  
I have table data (csv / excel) - total amount of data is about 35mb.  
The mapping for the index on one hand is disables \_source field and on the  
other hand enable few fields to be stored (total amount of all those fields  
is about 300-400 bytes), but the table data it-self is not store (default  
setting).  
It looks that the index size (on disk) is also about 35mb, is it normal ?  
Or there something that could be done to reduce the index size ?

Thank You and Best Regards.

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [January 13, 2012, 10:09pm UTC](https://discuss.elastic.co/t/index-size/6378/2 "2012-01-13T22:09:46Z")

</div>

why do you want to optimize it. what kind of problem(s) do you have  
because of that?

that asked 🙂 you could try to optimize the index and see if this  
would reduce the index size.

Peter.

On 13 Jan., 22:37, slavag [slav...@gmail.com](mailto:slav...@gmail.com) wrote:

> Hi,  
> I have table data (csv / excel) - total amount of data is about 35mb.  
> The mapping for the index on one hand is disables \_source field and on the  
> other hand enable few fields to be stored (total amount of all those fields  
> is about 300-400 bytes), but the table data it-self is not store (default  
> setting).  
> It looks that the index size (on disk) is also about 35mb, is it normal ?  
> Or there something that could be done to reduce the index size ?
> 
> Thank You and Best Regards.

---

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [January 13, 2012, 11:01pm UTC](https://discuss.elastic.co/t/index-size/6378/3 "2012-01-13T23:01:43Z")

</div>

The answer why do I want to optimize it is price of storage.  
When you said try to optimize the index, you meant to the source data or  
there any way to optimize index itself ?

Best Regards.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 14, 2012, 4:06pm UTC](https://discuss.elastic.co/t/index-size/6378/4 "2012-01-14T16:06:24Z")

</div>

You can use the optimize API With max\_segments parameter to reduce the  
number of internal index segments (by default, it will hover around 10).  
Can you gist your mapping? I did not quite follow your explanation.

On Sat, Jan 14, 2012 at 1:01 AM, slavag [slavago@gmail.com](mailto:slavago@gmail.com) wrote:

> The answer why do I want to optimize it is price of storage.  
> When you said try to optimize the index, you meant to the source data or  
> there any way to optimize index itself ?
> 
> Best Regards.

---

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [January 14, 2012, 5:42pm UTC](https://discuss.elastic.co/t/index-size/6378/5 "2012-01-14T17:42:39Z")

</div>

The mapping is :  
"csv" : {  
"\_source" : {  
"enabled" : false  
},  
"properties" : {  
"id" : {  
"index" : "not\_analyzed",  
"store" : "yes",  
"type" : "string"  
},  
"source" : {  
"index" : "not\_analyzed",  
"store" : "yes",  
"type" : "string"  
},  
"file" : {  
"index" : "no",  
"store" : "yes",  
"type" : "string"  
},  
"taskid" : {  
"index" : "not\_analyzed",  
"store" : "yes",  
"type" : "string"  
},  
"name" : {  
"index" : "not\_analyzed",  
"store" : "yes",  
"type" : "string"  
},  
"data" : {  
"type" : "string"  
},  
"date" : {  
"store" : "yes",  
"format" : "dateOptionalTime",  
"type" : "date"  
},  
"account" : {  
"index" : "not\_analyzed",  
"store" : "yes",  
"type" : "string"  
}  
}  
}

In the csv have about 55k rows each row has 5-10 fields that each field  
can have list of values, so all values within same row are indexed as one  
list (array) and mapped in the "data" field (you can see in the mapping)  
So, the total amount of source data with fields that are additional fields  
is about 25mb and index (on the disk) is also about same size (more or  
less).  
So the question is this ok ?  
And another question: is changing max\_segments could affect on index speed  
/ query speed ? Where is this configuration in java api ?

Thank You and Best Regards.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 17, 2012, 9:23am UTC](https://discuss.elastic.co/t/index-size/6378/6 "2012-01-17T09:23:19Z")

</div>

Your mapping looks fine. It seems like you store each file individually.  
You can have it another way though, instead of storing each field, you can  
store \_source, but exclude the data field, then, you will be able to  
compress it as well:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/source-field.html)(check  
exclude part).

Reducing the number of segments in the actual merge configuration will mean  
slower indexing. I suggested using the optimize call to reduce it once you  
loaded the data (its a one time effort).

On Sat, Jan 14, 2012 at 7:42 PM, slavag [slavago@gmail.com](mailto:slavago@gmail.com) wrote:

> The mapping is :  
> "csv" : {  
> "\_source" : {  
> "enabled" : false  
> },  
> "properties" : {  
> "id" : {  
> "index" : "not\_analyzed",  
> "store" : "yes",  
> "type" : "string"  
> },  
> "source" : {  
> "index" : "not\_analyzed",  
> "store" : "yes",  
> "type" : "string"  
> },  
> "file" : {  
> "index" : "no",  
> "store" : "yes",  
> "type" : "string"  
> },  
> "taskid" : {  
> "index" : "not\_analyzed",  
> "store" : "yes",  
> "type" : "string"  
> },  
> "name" : {  
> "index" : "not\_analyzed",  
> "store" : "yes",  
> "type" : "string"  
> },  
> "data" : {  
> "type" : "string"  
> },  
> "date" : {  
> "store" : "yes",  
> "format" : "dateOptionalTime",  
> "type" : "date"  
> },  
> "account" : {  
> "index" : "not\_analyzed",  
> "store" : "yes",  
> "type" : "string"  
> }  
> }  
> }
> 
> In the csv have about 55k rows each row has 5-10 fields that each field  
> can have list of values, so all values within same row are indexed as one  
> list (array) and mapped in the "data" field (you can see in the mapping)  
> So, the total amount of source data with fields that are additional fields  
> is about 25mb and index (on the disk) is also about same size (more or  
> less).  
> So the question is this ok ?  
> And another question: is changing max\_segments could affect on index speed  
> / query speed ? Where is this configuration in java api ?
> 
> Thank You and Best Regards.

---

<div class="post-metadata">

**Author:** ![Slava\_G](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@Slava\_G](https://discuss.elastic.co/u/Slava_G)\
**Post date:** [January 17, 2012, 9:36am UTC](https://discuss.elastic.co/t/index-size/6378/7 "2012-01-17T09:36:11Z")

</div>

Hi Shay,  
storing \_source is interesting approach, not thought about it, just wanted  
to ask is it really will help ? The "data" (all values list) field that  
actually indexed but not stored and \_source field will be indexed but not  
stored. Today "data" field it's not stored, only indexed and then if I add  
\_source to storage this only will increase indexes size or may be I didn't  
get you ?

Thank You.

P.S. I did optimize call win max\_segments = 1 size remains the same.

---

<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 6, 2017, 3:42am UTC](https://discuss.elastic.co/t/index-size/6378/8 "2017-07-06T03:42:32Z")

</div>


