# How to access the "fields" field in the Elasticsearch query rule

**URL:** <https://discuss.elastic.co/t/how-to-access-the-fields-field-in-the-elasticsearch-query-rule/345951>\
**Category:** Elastic Observability\
**Created:** [October 27, 2023, 7:25pm UTC](https://discuss.elastic.co/t/how-to-access-the-fields-field-in-the-elasticsearch-query-rule/345951 "2023-10-27T19:25:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MG989836](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@MG989836](https://discuss.elastic.co/u/MG989836)\
**Post date:** [October 27, 2023, 7:25pm UTC](https://discuss.elastic.co/t/how-to-access-the-fields-field-in-the-elasticsearch-query-rule/345951/1 "2023-10-27T19:25:33Z")

</div>

I am using Elastic & Kibana version 8.7.1

I created a runtime\_mappings field called "eventTime". I can see this runtime field and its value in the Kibana Discover page.

PUT /logs-parkingInfo/\_mapping  
{  
"dynamic": "runtime",  
"runtime": {  
"eventTime": {  
"type": "keyword",  
"script" : {  
"source" : "long milliSec = Long.parseLong(doc['timestamp'].value); Instant instant = Instant.ofEpochMilli(milliSec); ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.of('America/Los\_Angeles')); emit(zdt.format(DateTimeFormatter.ofPattern('yyyy-MM-dd @ HH:mm:ss.SSS')));"  
}  
}  
}  
}

But I cannot get the value of this runtime field (eventTime) in Elasticsearch query rule body.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fc8fc3387e4e535ba11fe4f202515c34fc86a906.png)

{  
...  
"short\_description": "smartParking error 1115 - No Communication with management system",  
"description": "Event Time: {{#context.hits.0}}{{fields.eventTime}}{{/context.hits.0}},  
virtualParkingId: {{#context.hits.0}}{{\_source.virtualParkingId}}{{/context.hits.0}}",  
"contact\_type":"Event Management",  
"u\_event\_source":"Elastic",  
"impact":"2 - Medium",  
...  
}

How do I access the runtime field eventTime? I tried the following codes, both ways did not work.  
{{#context.hits.0}}{{fields.eventTime}}{{/context.hits.0}}  
{{#context.hits.0}}{{\_source.eventTime}}{{/context.hits.0}}

Can someone give me some suggestion?

Thank you

---

<div class="post-metadata">

**Author:** ![azizim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azizim/32/127005_2.png) [@azizim](https://discuss.elastic.co/u/azizim)\
**Post date:** [October 27, 2023, 8:17pm UTC](https://discuss.elastic.co/t/how-to-access-the-fields-field-in-the-elasticsearch-query-rule/345951/2 "2023-10-27T20:17:06Z")

</div>

As its name indicates runtime field is only a field that is available during the runtime of the query , as a result it is not indexed into the document itself.  
You can access it as any other field in the query  
you can check here for more details: [Map a runtime field | Elasticsearch Guide [8.10] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime-mapping-fields.html)
