# Length of the body of an object

**URL:** <https://discuss.elastic.co/t/length-of-the-body-of-an-object/143136>\
**Category:** Elasticsearch\
**Created:** [August 6, 2018, 9:57am UTC](https://discuss.elastic.co/t/length-of-the-body-of-an-object/143136 "2018-08-06T09:57:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phia](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@phia](https://discuss.elastic.co/u/phia)\
**Post date:** [August 6, 2018, 9:57am UTC](https://discuss.elastic.co/t/length-of-the-body-of-an-object/143136/1 "2018-08-06T09:57:38Z")

</div>

Hello guys,

I have a JSON Object with the following structure:

```
{
   "_index": ... ,
   ... ,
   "_source": {
      "JobResult": "OK",
      "JobSpecification": {
         "ColorsOfPages": {
            "Page1": {
               "Yellow": 10.1,
               "Black": 9.0,
               "Cyan": 7.3,
               "Magenta": 1.1
            },
           "Page1": {
               "Yellow": 11.3,
               "Black": 10.2,
               "Cyan": 10.6,
               "Magenta": 3.1
            },
            ...
         }
      }
   }
}

```

Now I want to find out **how many pages** I have and **add the single values**.  
Can you help me please? 💁🏻‍♀️

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 6, 2018, 3:56pm UTC](https://discuss.elastic.co/t/length-of-the-body-of-an-object/143136/2 "2018-08-06T15:56:10Z")

</div>

Hey,

you could use an [ingest script processor](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/script-processor.html) and check the size of the `ColorsOfPages` map.

--Alex

---

<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:** [September 3, 2018, 3:56pm UTC](https://discuss.elastic.co/t/length-of-the-body-of-an-object/143136/3 "2018-09-03T15:56:14Z")

</div>

Closed on September 3, 2018, 3:56pm UTC

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