# \_script is not getting referred

**URL:** <https://discuss.elastic.co/t/script-is-not-getting-referred/168824>\
**Category:** Elasticsearch\
**Created:** [February 18, 2019, 12:23pm UTC](https://discuss.elastic.co/t/script-is-not-getting-referred/168824 "2019-02-18T12:23:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binu\_Andrews](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@Binu\_Andrews](https://discuss.elastic.co/u/Binu_Andrews)\
**Post date:** [February 18, 2019, 12:23pm UTC](https://discuss.elastic.co/t/script-is-not-getting-referred/168824/1 "2019-02-18T12:23:37Z")

</div>

I am trying to access below script from an email action. The action is getting triggered, but the email subject is not getting fetched from the template. insted of that, what ever i mentioned as the id name is going as the email subject.

**\_script**  
{  
"\_id" : "email\_subject",  
"found" : true,  
"script" : {  
"lang" : "mustache",  
"source" : "test email subject"  
}  
}

**Email Action**

```
"email" : {
      "profile" : "standard",
      "to" : [
        "abc@xxx.com"
      ],
      "subject" : {
        "id":"email_subject"
      },
      "body" : {
        "text" : "Watch [{{ctx.metadata.name}}] has exceeded the threshold"
      }
    }
```

---

<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:** [March 18, 2019, 12:23pm UTC](https://discuss.elastic.co/t/script-is-not-getting-referred/168824/2 "2019-03-18T12:23:37Z")

</div>

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