# Dot in field name for email body

**URL:** <https://discuss.elastic.co/t/dot-in-field-name-for-email-body/178343>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [April 25, 2019, 1:58am UTC](https://discuss.elastic.co/t/dot-in-field-name-for-email-body/178343 "2019-04-25T01:58:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_gandhe](https://avatars.discourse-cdn.com/v4/letter/_/ea5d25/32.png) [@\_gandhe](https://discuss.elastic.co/u/_gandhe)\
**Post date:** [April 25, 2019, 1:58am UTC](https://discuss.elastic.co/t/dot-in-field-name-for-email-body/178343/1 "2019-04-25T01:58:41Z")

</div>

Hi,

I want to use the field in body of email alert.  
field name is "cps-aks.paranoid"

I can access the field using the following syntax - ctx.payload.hits.hits.0.\_source.cps-aks.paranoid.

Problem is there is a dot in the field "cps-aks.paranoid", due to which I am getting blank in while using moustache template {{ctx.payload.hits.hits.0.\_source.cps-aks.paranoid}}.

How can I escape the dot in the field name and access the value in email body?

---

<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:** [April 25, 2019, 6:24am UTC](https://discuss.elastic.co/t/dot-in-field-name-for-email-body/178343/2 "2019-04-25T06:24:50Z")

</div>

Hey,

there is no way in mustache to access that field as far as I know. However you could use a transform to change the field names from `foo.bar` to `foo-bar`.

See this simplified example

```auto
POST _watcher/watch/_execute
{
  "watch": {
    "trigger": {
      "schedule": {
        "interval": "10h"
      }
    },
    "input": {
      "simple": {
        "foo.foo": "bar"
      }
    },
    "actions": {
      "logme": {
        "transform" : {
          "script" : {
            "lang" : "painless",
            "source" : "ctx.payload['foo-bar']=ctx.payload['foo.foo'] ; return ctx.payload"
          }
        },
        "logging": {
          "text": "{{ctx.payload.foo-bar}}"
        }
      }
    }
  }
}

```

hope this helps!

--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:** [May 23, 2019, 6:24am UTC](https://discuss.elastic.co/t/dot-in-field-name-for-email-body/178343/3 "2019-05-23T06:24:57Z")

</div>

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