# Scripted fields defined in kibana - when executed?

**URL:** <https://discuss.elastic.co/t/scripted-fields-defined-in-kibana-when-executed/269814>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [April 11, 2021, 3:10pm UTC](https://discuss.elastic.co/t/scripted-fields-defined-in-kibana-when-executed/269814 "2021-04-11T15:10:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![kavierkoo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kavierkoo/32/86555_2.png) [@kavierkoo](https://discuss.elastic.co/u/kavierkoo)\
**Post date:** [April 11, 2021, 4:27pm UTC](https://discuss.elastic.co/t/scripted-fields-defined-in-kibana-when-executed/269814/4 "2021-04-11T16:27:37Z")

</div>

I believe @flash1293 answered your question below

> [scripted fields](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html), Kibana adds a layer on top of that and remembers to attach them to each request Kibana is making on your behalf. You can't persist them directly as part the Elasticsearch index.

> However if you want to persist the values of your script you can do so by defining an ingest pipeline with a script processor: [https://www.elastic.co/guide/en/elasticsearch/reference/7.5/script-processor.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.5/script-processor.html)
> 
> This won't save the script itself, but the computed values in the Elasticsearch index. This also means you have to re-index your data if you ever change your script, but it will be much more efficient while querying data.

The post is here

> [@Scripted fields in kibana to elastic?](https://discuss.elastic.co/t/scripted-fields-in-kibana-to-elastic/218110/2):
>
> Hi @umay_fb, [scripted fields](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html) are by definition a run-time thing that has to be sent to Elasticsearch with every query. Kibana adds a layer on top of that and remembers to attach them to each request Kibana is making on your behalf. You can't persist them directly as part the Elasticsearch index. However if you want to persist the values of your script you can do so by defining an ingest pipeline with a script processor: [https://www.elastic.co/guide/en/elasticsearch/reference/7.5/script-process…](https://www.elastic.co/guide/en/elasticsearch/reference/7.5/script-processor.html)

---

_[View the full topic](https://discuss.elastic.co/t/scripted-fields-defined-in-kibana-when-executed/269814)._
