# Actual Size of a document - Mapper Size Plugin

**URL:** <https://discuss.elastic.co/t/actual-size-of-a-document-mapper-size-plugin/326631>\
**Category:** Elasticsearch\
**Created:** [February 27, 2023, 8:48pm UTC](https://discuss.elastic.co/t/actual-size-of-a-document-mapper-size-plugin/326631 "2023-02-27T20:48:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prateek\_shekhar](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@prateek\_shekhar](https://discuss.elastic.co/u/prateek_shekhar)\
**Post date:** [February 27, 2023, 8:48pm UTC](https://discuss.elastic.co/t/actual-size-of-a-document-mapper-size-plugin/326631/1 "2023-02-27T20:48:37Z")

</div>

Hi All,

Recently we have enabled the mapper-size plugin on our ES cluster. We have also added the index mapping \_size as per the recommendations at this link: [Using the \_size field | Elasticsearch Plugins and Integrations [8.6] | Elastic](https://www.elastic.co/guide/en/elasticsearch/plugins/current/mapper-size-usage.html)

We are trying to keep the track of largest documents in our ES cluster. However I observed one behavior:  
We use the following query to find the top 50 largest documents in the index:

```auto
{
    "from": 0,
    "size": 50,
    "query": {
        "match_all": {}
    },
    "sort": [
        {
            "_size": {
                "order": "desc"
            }
        }
    ],
    "script_fields": {
        "size": {
            "script": "doc['_size']"
        }
    },
    "_source": [
        "id"
    ]
}

```

Let's say that this query returns a document with id : 123 as the top most result. Now in the response it is observed that the size of the document is 35084836 bytes (35MB).

However if I download this document using the curl command:  
`curl https://es-endpoint/index_name/_doc/123 -H "Accept: application/json" > 123.json`

it is observed that the document size is only about 1022118 bytes (1 MB).

Can someone please explain this discrepancy to me? I might be missing something here.

---

<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:** [March 27, 2023, 8:49pm UTC](https://discuss.elastic.co/t/actual-size-of-a-document-mapper-size-plugin/326631/2 "2023-03-27T20:49:27Z")

</div>

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