# Scripted field internals

**URL:** <https://discuss.elastic.co/t/scripted-field-internals/176468>\
**Category:** Kibana\
**Created:** [April 11, 2019, 5:30pm UTC](https://discuss.elastic.co/t/scripted-field-internals/176468 "2019-04-11T17:30:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravitandur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravitandur/32/4568_2.png) [@ravitandur](https://discuss.elastic.co/u/ravitandur)\
**Post date:** [April 11, 2019, 5:30pm UTC](https://discuss.elastic.co/t/scripted-field-internals/176468/1 "2019-04-11T17:30:45Z")

</div>

Hi ,  
Can someone please explain how scripted fields works internally. For ex. If I add a scripted field which extract the numeric value from existing field using regular expression and used in aggregations. I want to understand and to end execution of the flow i.e. on which nodes the regex will be executed on each document and how the aggregations works on scripted fields. If any blog explains this functionality please share.  
Thanks  
Ravi

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [April 12, 2019, 1:17pm UTC](https://discuss.elastic.co/t/scripted-field-internals/176468/2 "2019-04-12T13:17:49Z")

</div>

Hello,

Would this be enough to answer your questions?  
[https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)

Let me know if there something else that isn't covered there and I'll try to answer it.

---

<div class="post-metadata">

**Author:** ![ravitandur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravitandur/32/4568_2.png) [@ravitandur](https://discuss.elastic.co/u/ravitandur)\
**Post date:** [April 12, 2019, 1:28pm UTC](https://discuss.elastic.co/t/scripted-field-internals/176468/3 "2019-04-12T13:28:38Z")

</div>

Thank you. I already gone through the link u provided before posting .  
I want to understand more on how scripted fields works internally, where these scripts will be executed for each document? Is these fields used normally as other indexed fields in elasticsearch cluster? I am intrested in end to end functionality of scripted fields .

Thanks  
Ravi

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [April 12, 2019, 1:54pm UTC](https://discuss.elastic.co/t/scripted-field-internals/176468/4 "2019-04-12T13:54:01Z")

</div>

The scripted fields in Kibana are executed individually for each document indeed. And Kibana passes the definition of them to ES on each requests and ES determines if it needs to calculate them. They can be used normally, with some limitations. Overall, they are good if you want to test or debug something in your data, but for day to day use they are no recommended as each search request sent to ES will put more more load on the cluster than normally.

this explains it a bit as well:

> **[Using Painless in Kibana scripted fields
	  	 | Elastic](https://www.elastic.co/blog/using-painless-kibana-scripted-fields)**
>
> Kibana provides powerful ways to search and visualize data stored in Elasticsearch. For the purpose of visualizations, Kibana looks for fields defined in Elasticsearch mappings and presents them as op...

---

<div class="post-metadata">

**Author:** ![ravitandur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravitandur/32/4568_2.png) [@ravitandur](https://discuss.elastic.co/u/ravitandur)\
**Post date:** [April 13, 2019, 9:06am UTC](https://discuss.elastic.co/t/scripted-field-internals/176468/5 "2019-04-13T09:06:47Z")

</div>

Thank you. I got the required information from blog.

---

<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:** [May 11, 2019, 9:06am UTC](https://discuss.elastic.co/t/scripted-field-internals/176468/6 "2019-05-11T09:06:49Z")

</div>

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