# Document size, weight and performance in an automatic mapping and improve it afterwards manually

**URL:** https://discuss.elastic.co/t/document-size-weight-and-performance-in-an-automatic-mapping-and-improve-it-afterwards-manually/330085
**Category:** Elasticsearch
**Created:** [April 16, 2023, 11:22am UTC](https://discuss.elastic.co/t/document-size-weight-and-performance-in-an-automatic-mapping-and-improve-it-afterwards-manually/330085 "2023-04-16T11:22:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)
#### Post date: [April 16, 2023, 11:22am UTC](https://discuss.elastic.co/t/document-size-weight-and-performance-in-an-automatic-mapping-and-improve-it-afterwards-manually/330085/1 "2023-04-16T11:22:52Z")

</div>

Is it possible to know the weight of a document in terms of bytes, to know the impact index in terms of indexing?

All this in order to better optimize, to know how to configure a mapping of fields in such and such a way?

in my case I have a log which is in JSON format, one line one log.  
Not knowing at the beginning the various possible fields that will be in this log, I have it parsed by logstash to convert the json line into fields in elasticsearch, I leave elasticsearch in dynamic mode for the mapping for a trial period so that it make me the basis of all the fields during this period of time.  
It will therefore create a mapping for me on the fly.  
Then I would like to know if what it generated is wise, see if I can't improve because such and such an element should not be searchable, or put it only keyword etc...

sorry for my bad English

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 16, 2023, 12:05pm UTC](https://discuss.elastic.co/t/document-size-weight-and-performance-in-an-automatic-mapping-and-improve-it-afterwards-manually/330085/2 "2023-04-16T12:05:03Z")

</div>

Bonjour Fabrice

I think that you can get the size of the source by using the mapper size plugin.

And may be: [Index stats API | Elasticsearch Guide [8.7] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html)

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [April 16, 2023, 2:23pm UTC](https://discuss.elastic.co/t/document-size-weight-and-performance-in-an-automatic-mapping-and-improve-it-afterwards-manually/330085/3 "2023-04-16T14:23:19Z")

</div>

Also the analyze disk usage API gives a picture of the disk usage of each field:

> **[Analyze index disk usage API | Elasticsearch Guide \[master\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-disk-usage.html)**
>
> ELSER is a learned sparse ranking model trained by Elastic.

Moreover the field usage stats API can help you understand which parts of your mapping are unused:

> **[Field usage stats API | Elasticsearch Guide \[master\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/master/field-usage-stats.html)**
>
> ELSER is a learned sparse ranking model trained by Elastic.

---

<div class="post-metadata">

### Author: ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)
#### Post date: [April 17, 2023, 5:13am UTC](https://discuss.elastic.co/t/document-size-weight-and-performance-in-an-automatic-mapping-and-improve-it-afterwards-manually/330085/4 "2023-04-17T05:13:21Z")

</div>

I will test as soon as possible thank you

---

<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: [May 15, 2023, 5:14am UTC](https://discuss.elastic.co/t/document-size-weight-and-performance-in-an-automatic-mapping-and-improve-it-afterwards-manually/330085/5 "2023-05-15T05:14:15Z")

</div>

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