# How to Access Field that made by Scripted field

**URL:** <https://discuss.elastic.co/t/how-to-access-field-that-made-by-scripted-field/324610>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [February 3, 2023, 8:02am UTC](https://discuss.elastic.co/t/how-to-access-field-that-made-by-scripted-field/324610 "2023-02-03T08:02:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuswanul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuswanul/32/101662_2.png) [@yuswanul](https://discuss.elastic.co/u/yuswanul)\
**Post date:** [February 3, 2023, 8:02am UTC](https://discuss.elastic.co/t/how-to-access-field-that-made-by-scripted-field/324610/1 "2023-02-03T08:02:43Z")

</div>

Hi everyone,

i've been made scripted field like this:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/4/f40fe6cb16a09467927ed12f1e5b415b256c9457.png)

From the script, it generates field named expire\_days with number data type  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/4/749e78707b98f7d68ae313c9b6cc133ec36e0d5b.png)

and I have also created an alert that points to this index. The problem is if i want to show expire\_days value in alert message, how do i do it? i tried like this but it didn't work. i used context.hits also to call fields under \_source  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/647b746ca37e07a419651a2a0ffb40f2b11b3bf1.png)

but how to call a field under _ **fields** _ in alert message? fyi, i used v7.17.0 and the alert that i made was an elasticsearch query type

Thanks

---

<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 3, 2023, 8:03am UTC](https://discuss.elastic.co/t/how-to-access-field-that-made-by-scripted-field/324610/2 "2023-03-03T08:03:38Z")

</div>

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