# Alias field not working

**URL:** <https://discuss.elastic.co/t/alias-field-not-working/177328>\
**Category:** Elasticsearch\
**Created:** [April 17, 2019, 3:07pm UTC](https://discuss.elastic.co/t/alias-field-not-working/177328 "2019-04-17T15:07:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvolpi](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jvolpi](https://discuss.elastic.co/u/jvolpi)\
**Post date:** [April 17, 2019, 3:07pm UTC](https://discuss.elastic.co/t/alias-field-not-working/177328/1 "2019-04-17T15:07:18Z")

</div>

Hello everyone, i'm having an issue:

When i create an alias field linking to an existing field, it creates succesfully but has no value. I create the field in the following manner:

```
  "deviceID": {
    "type": "alias",
    "path": "m.Device.id"
  }

```

I noticed one thing, my document values are all stored in the \_source field (that's how they are indexed from logstash) except a date field i create using the logstash date filter. That last value goes to the "fields" section of the documents and when i create an alias of that field it works perfectly.

So, is the fact that the fields are in the \_source section the problem? In that case. why can't i create an alias of a \_source field?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 18, 2019, 6:04am UTC](https://discuss.elastic.co/t/alias-field-not-working/177328/2 "2019-04-18T06:04:19Z")

</div>

What does your mapping for the index look like?

---

<div class="post-metadata">

**Author:** ![jvolpi](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jvolpi](https://discuss.elastic.co/u/jvolpi)\
**Post date:** [April 22, 2019, 12:54pm UTC](https://discuss.elastic.co/t/alias-field-not-working/177328/3 "2019-04-22T12:54:33Z")

</div>

Here is the template settings of my indexes. Actually, there are more fields but i removed them for the sake of simplicity.

The 'DateTime' alias works perfectly, but the 'deviceID' one doesn't.

```
PUT _template/templatelogstash
{
  "index_patterns": ["logstash*"],
  "settings": {
    "number_of_shards": 5,
    "index.lifecycle.name": "logstash-policy"
  },
  "mappings": {
    "_source": {
      "enabled": true
    },
    "properties": {
      "m" : {
        "properties" : {
          "Conection" : {
            "properties" : {
              "Date" : {
                "type" : "date",
                "format" : "M/d/yyyy H:mm:ss Z||M/d/yyyy K:mm:ss a Z"
              }
            }
          },
          "Device" : {
            "properties" : {
              "id" : {
                "type" : "text",
                "fields" : {
                  "keyword" : {
                    "type" : "keyword",
                    "ignore_above" : 256
                  }
                }
              }
            }
          }
        }
      },
      "deviceID": {
        "type": "alias",
        "path": "m.Device.id"
      },
      "DateTime": {
        "type": "alias",
        "path": "m.Conection.Date"
      }
    }
  }
}
```

---

<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 20, 2019, 12:54pm UTC](https://discuss.elastic.co/t/alias-field-not-working/177328/4 "2019-05-20T12:54:36Z")

</div>

Closed on May 20, 2019, 12:54pm UTC

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