# Using runtime field in another runtime field in Kibana index template

**URL:** <https://discuss.elastic.co/t/using-runtime-field-in-another-runtime-field-in-kibana-index-template/320734>\
**Category:** Kibana\
**Tags:** runtime-fields\
**Created:** [December 8, 2022, 5:03am UTC](https://discuss.elastic.co/t/using-runtime-field-in-another-runtime-field-in-kibana-index-template/320734 "2022-12-08T05:03:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikhatanu](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@mikhatanu](https://discuss.elastic.co/u/mikhatanu)\
**Post date:** [December 8, 2022, 5:03am UTC](https://discuss.elastic.co/t/using-runtime-field-in-another-runtime-field-in-kibana-index-template/320734/1 "2022-12-08T05:03:18Z")

</div>

I have a runtime field called "throughput\_in" with type long and the following script:

```auto
throughput_in:
emit(doc['volume_uplink'].value / doc['duration'].value)

```

and a field called "throughput\_out" with type long:

```auto
throughput_out:
emit(doc['volume_downlink'].value / doc['duration'].value)

```

I want to use the runtime field in another runtime field called "throughput\_total" with type long:

```auto
throughput_total:
emit(doc['throughput_in'].value + doc['throughput_out'].value)

```

but the autocomplete doesn't show the runtime field. Is doing this possible?

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [December 20, 2022, 5:37pm UTC](https://discuss.elastic.co/t/using-runtime-field-in-another-runtime-field-in-kibana-index-template/320734/2 "2022-12-20T17:37:17Z")

</div>

Hi @mikhatanu

maybe a composite runtime field can work in your case?

> **[Explore your data with runtime fields | Elasticsearch Guide \[master\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/master/runtime-examples.html#runtime-examples-grok-composite)**

---

<div class="post-metadata">

**Author:** ![mikhatanu](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@mikhatanu](https://discuss.elastic.co/u/mikhatanu)\
**Post date:** [December 21, 2022, 6:13am UTC](https://discuss.elastic.co/t/using-runtime-field-in-another-runtime-field-in-kibana-index-template/320734/3 "2022-12-21T06:13:33Z")

</div>

I found out that you can use runtime field to another runtime field (in this case, using runtime field throughput\_in and throughput\_out to produce throughput\_total). The field just doesn't appear in autocomplete, but it is possible to do it.

---

<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:** [January 18, 2023, 6:13am UTC](https://discuss.elastic.co/t/using-runtime-field-in-another-runtime-field-in-kibana-index-template/320734/4 "2023-01-18T06:13:59Z")

</div>

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