# Question About Nested Objects Mapping

**URL:** <https://discuss.elastic.co/t/question-about-nested-objects-mapping/103282>\
**Category:** Elasticsearch\
**Created:** [October 10, 2017, 2:08am UTC](https://discuss.elastic.co/t/question-about-nested-objects-mapping/103282 "2017-10-10T02:08:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krmathieu](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@krmathieu](https://discuss.elastic.co/u/krmathieu)\
**Post date:** [October 10, 2017, 2:08am UTC](https://discuss.elastic.co/t/question-about-nested-objects-mapping/103282/1 "2017-10-10T02:08:27Z")

</div>

On the root level of my documents I have an array of objects called entities and for each entity in that array there is a an array of objects called mentions that will contain one or more mentions objects for that entity. I know that I need to map the mentions as type nested to do aggregations, etc, but what about entities? It is at the root level and not nested per se, but will I be able to drill down to the mentions objects without also specifying entities as type nested as well? Any thoughts anyone might have would be appreciated. Thanks.

Kevin

---

<div class="post-metadata">

**Author:** ![Rory](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@Rory](https://discuss.elastic.co/u/Rory)\
**Post date:** [October 12, 2017, 8:31pm UTC](https://discuss.elastic.co/t/question-about-nested-objects-mapping/103282/2 "2017-10-12T20:31:03Z")

</div>

If I understand the question correctly, then you will need to have mentions as a nested type inside entity which in itself is nested.

A sample document would look like:

Doc:

```
{
  "column1":1,
  "column2":2,
  "column3":3,
  "entity": [
    {
      "entitycolumn1": 11,
      "mention" : [
        {
          "mentionid" : 1,
          "mentioncolumn1" : "a",
          "mentioncolumn2" : "b"
        },
        {
          "mentionid" : 2
          "mentioncolumn1" : "c",
          "mentioncolumn2" : "d"
        }
      ]
    },
    {
       //2nd nested entity document
    }
  ]
}
```

---

<div class="post-metadata">

**Author:** ![krmathieu](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@krmathieu](https://discuss.elastic.co/u/krmathieu)\
**Post date:** [November 1, 2017, 6:35pm UTC](https://discuss.elastic.co/t/question-about-nested-objects-mapping/103282/3 "2017-11-01T18:35:45Z")

</div>

@Rory thanks for the suggestion, I will give that a try.

---

<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:** [November 29, 2017, 6:36pm UTC](https://discuss.elastic.co/t/question-about-nested-objects-mapping/103282/4 "2017-11-29T18:36:30Z")

</div>

Closed on November 29, 2017, 6:36pm UTC

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