# How to define field alias to nested objects

**URL:** <https://discuss.elastic.co/t/how-to-define-field-alias-to-nested-objects/151417>\
**Category:** Elasticsearch\
**Created:** [October 8, 2018, 9:26am UTC](https://discuss.elastic.co/t/how-to-define-field-alias-to-nested-objects/151417 "2018-10-08T09:26:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahendra\_Shinde](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Mahendra\_Shinde](https://discuss.elastic.co/u/Mahendra_Shinde)\
**Post date:** [October 8, 2018, 9:26am UTC](https://discuss.elastic.co/t/how-to-define-field-alias-to-nested-objects/151417/1 "2018-10-08T09:26:33Z")

</div>

Hi,  
I have mapping like this

```auto
{
 "mappings": {
   "my_data": {
     "properties": {
   emotion_json": {
         "type": "nested",
         "properties": {
           "total_count": {
             "type": "integer"
           },
           "emotion_type": {
             "type": "text"
           },
           "name": {
             "type": "keyword"
           },
           "matches": {
             "properties": {
               "phrase": {
                 "type": "text"
               },
               "count": {
                 "type": "integer"
               }
             }
           }
         }
       }        
     }
   }
 }
}

```

And I wish to create alias to 'name' field. I need create it to use in Kibana.  
I tried to create using below command

```auto
PUT /data_mahendra_288/_mapping/my_data
{
  "my_data": {
    "properties": {
      "emotion_json_name_alias": {
        "type": "alias",
        "path": "emotion_json.name"
      }
    }
  }
}

```

but not working. Any guess why?

---

<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 5, 2018, 9:26am UTC](https://discuss.elastic.co/t/how-to-define-field-alias-to-nested-objects/151417/2 "2018-11-05T09:26:48Z")

</div>

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