# Dynamic Mapping for Nested Objects

**URL:** <https://discuss.elastic.co/t/dynamic-mapping-for-nested-objects/270628>\
**Category:** Elasticsearch\
**Created:** [April 19, 2021, 9:27pm UTC](https://discuss.elastic.co/t/dynamic-mapping-for-nested-objects/270628 "2021-04-19T21:27:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![schawla](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@schawla](https://discuss.elastic.co/u/schawla)\
**Post date:** [April 19, 2021, 9:27pm UTC](https://discuss.elastic.co/t/dynamic-mapping-for-nested-objects/270628/1 "2021-04-19T21:27:24Z")

</div>

Is it possible to have dynamic mapping for a nested object like the following -

```auto

employee
{
   "id":"1",
   "name":"manager",
   "assistants":[
   {
      "id":"2",
      "name":"assistant1"
    },
      {
      "id":"3",
      "name":"assistant2"
    }
  ]
}

```

I am not defining any dynamic mapping template or custom mapping for my index. I want Elastic search to automatically recognize the nested structure when i index this json and form the mapping as the following so that i can use nested query on these documents

```auto
assistants : { "type":"nested"} 

```

---

<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 17, 2021, 9:27pm UTC](https://discuss.elastic.co/t/dynamic-mapping-for-nested-objects/270628/2 "2021-05-17T21:27:53Z")

</div>

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